Maintenance mode set to enable on beta/sanchonet by @Ryun1 #4
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: Toggle (enable/disable) maintenance page | |
run-name: Maintenance mode set to ${{ inputs.maintenance }} on ${{ inputs.environment }}/${{ inputs.cardano_network }} by @${{ github.actor }} | |
on: | |
workflow_dispatch: | |
inputs: | |
cardano_network: | |
required: true | |
type: choice | |
default: "sanchonet" | |
options: | |
- "sanchonet" | |
environment: | |
required: true | |
type: choice | |
default: "dev" | |
options: | |
- "dev" | |
- "test" | |
- "staging" | |
- "beta" | |
maintenance: | |
required: true | |
type: choice | |
default: "enable" | |
options: | |
- "enable" | |
- "disable" | |
env: | |
ENVIRONMENT: ${{ inputs.environment || 'dev' }} | |
CARDANO_NETWORK: ${{ inputs.cardano_network || 'sanchonet' }} | |
jobs: | |
check_environment_exists: | |
name: Check if target environment exists before proceeding | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./scripts/govtool | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Check environment exists | |
run: | | |
make check-env-defined cardano_network=$CARDANO_NETWORK env=$ENVIRONMENT | |
toggle_maintenance: | |
name: Toggl maintenance state | |
needs: | |
- check_environment_exists | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./scripts/govtool | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-access-key-id: ${{ secrets.GHA_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.GHA_AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Login to AWS ECR | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: eu-west-1 | |
- name: Setup SSH agent | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.GHA_SSH_PRIVATE_KEY }} | |
- name: Toggle maintenance | |
run: | | |
make docker-login | |
if [[ "${{ inputs.environment }}" == "staging" ]]; then export DOMAIN=staging.govtool.byron.network; fi; | |
if [[ "${{ inputs.environment }}" == "beta" ]]; then export DOMAIN=sanchogov.tools; fi; | |
make toggle-maintenance cardano_network=$CARDANO_NETWORK env=$ENVIRONMENT maintenance=${{ inputs.maintenance || 'disable' }} |