Manual Env Deploy #409
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manual Env Deploy | |
on: | |
workflow_dispatch: | |
inputs: | |
destination_branch: | |
type: choice | |
description: 'Destination environment' | |
required: true | |
default: 'stage' | |
options: ['stage', 'main'] | |
jobs: | |
version-bump: | |
uses: ./.github/workflows/version-bump.yml | |
stage-merge: | |
if: | | |
always() | |
needs: version-bump | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if user is allowed to execute the workflow | |
run: | | |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' && ("${{ github.actor }}" != 'coretex-admin' && "${{ github.actor }}" != 'igorperic17' && "${{ github.actor }}" != 'dule1322' && "${{ github.repository_owner }}" != "${{ github.actor }}" ) ]]; then | |
echo "::error::You are not authorized to execute this workflow." | |
exit 1 | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Merge develop into destination branch | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git fetch | |
git checkout stage | |
git pull | |
git pull --rebase origin develop | |
git push --force | |
prod-merge: | |
needs: stage-merge | |
runs-on: ubuntu-latest | |
if: ${{ github.event.inputs.destination_branch == 'main' }} | |
steps: | |
- name: Check if user is allowed to execute the workflow | |
run: | | |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' && ("${{ github.actor }}" != 'coretex-admin' && "${{ github.actor }}" != 'igorperic17' && "${{ github.actor }}" != 'dule1322' && "${{ github.repository_owner }}" != "${{ github.actor }}" ) ]]; then | |
echo "::error::You are not authorized to execute this workflow." | |
exit 1 | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Merge develop into destination branch | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git fetch | |
git checkout main | |
git pull | |
git pull --rebase origin stage | |
git push --force | |
deploy-pypi: | |
needs: prod-merge | |
if: ${{ (github.event.inputs.destination_branch == 'main') && success() }} | |
uses: ./.github/workflows/python-publish.yml | |
secrets: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
deploy-docs: | |
needs: deploy-pypi | |
if: ${{ (github.event.inputs.destination_branch == 'main') && success() }} | |
uses: ./.github/workflows/deploy_docs_to_s3.yml | |
with: | |
ENVIRONMENT: ${{ github.event.inputs.destination_branch }} | |
secrets: | |
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} | |
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }} | |
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} |