Destroy #1722
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: Destroy | |
on: delete | |
permissions: | |
id-token: write | |
contents: read | |
actions: read | |
jobs: | |
destroy: | |
if: github.event.ref_type == 'branch' | |
runs-on: ubuntu-latest | |
steps: | |
- name: set branch_name | |
run: echo "branch_name=${{ github.event.ref }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- name: set branch specific variable names | |
run: ./.github/build_vars.sh set_names | |
- name: set variable values | |
run: ./.github/build_vars.sh set_values | |
env: | |
AWS_OIDC_ROLE_TO_ASSUME: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME] || secrets.AWS_OIDC_ROLE_TO_ASSUME }} | |
AWS_DEFAULT_REGION: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }} | |
STAGE_PREFIX: ${{ secrets.STAGE_PREFIX }} | |
- name: Configure AWS credentials for GitHub Actions | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: lock this branch to prevent concurrent builds | |
run: ./.github/github-lock.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: ./destroy.sh $STAGE_PREFIX$branch_name | |
- name: Tell bigmac which topics to delete | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Delete Topics | |
repo: Enterprise-CMCS/bigmac | |
ref: refs/heads/master # OneMAC uses develop, bigmac uses master, dispatch assumes same name | |
token: ${{ secrets.BIGMAC_PERSONAL_ACCESS_TOKEN }} | |
inputs: '{ "topics": "mgmt.connect.stream-functions-${{ env.branch_name }}.offsets,mgmt.connect.stream-functions-${{ env.branch_name }}.config,mgmt.connect.stream-functions-${{ env.branch_name }}.status"}' |