Switch active stack to int-sandbox-1 in int-sandbox by hamzakhan24-nhs #9
Workflow file for this run
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: Switch Active Stack | |
run-name: Switch active stack to ${{ inputs.stack_name }} in ${{ inputs.environment }} by ${{ github.actor }} | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "Environment to activate the stack in" | |
required: true | |
default: "dev" | |
type: environment | |
stack_name: | |
description: Name of stack to activate | |
required: true | |
type: string | |
permissions: | |
id-token: write | |
contents: read | |
actions: write | |
jobs: | |
activate-stack: | |
name: Activate ${{ inputs.stack_name }} for ${{ inputs.environment }} | |
runs-on: [self-hosted, ci] | |
environment: ${{ inputs.environment }} | |
steps: | |
- name: Git clone - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup asdf cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.asdf | |
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }} | |
restore-keys: | | |
${{ runner.os }}-asdf- | |
- name: Install asdf | |
uses: asdf-vm/actions/[email protected] | |
- name: Configure Management Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-west-2 | |
role-to-assume: ${{ secrets.MGMT_ROLE_ARN }} | |
role-session-name: github-actions-ci-${{ inputs.environment }}-${{ github.run_id}} | |
- name: Install zip | |
run: sudo apt-get install zip | |
- name: Setup Python environment | |
run: | | |
poetry install --no-root | |
source $(poetry env info --path)/bin/activate | |
- name: Get current environment config | |
run: | | |
poetry run python ./scripts/get_env_config.py all ${{ inputs.environment }} | |
- name: Activate Stack | |
run: | | |
poetry run python ./scripts/activate_stack.py ${{ inputs.stack_name }} ${{ inputs.environment }} |