Feature/h3ronpy #5
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: Destroy Preview Environment | |
on: | |
pull_request: | |
types: | |
- closed | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
jobs: | |
destroy: | |
concurrency: Space2Stats API Dev | |
environment: Space2Stats API Dev | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Install AWS CDK | |
run: npm install -g aws-cdk | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::017820688988:role/Space2Stats-Deploy-Role | |
aws-region: ${{ vars.CDK_DEFAULT_REGION }} | |
- name: Install CDK dependencies | |
working-directory: ./space2stats_api/cdk | |
run: | | |
pip install -r requirements-cdk.txt | |
- name: Tear down CDK stack | |
working-directory: ./space2stats_api/cdk | |
env: | |
STAGE: pr-${{ github.event.pull_request.number }} | |
PGHOST: ${{ secrets.PGHOST }} | |
PGPORT: ${{ secrets.PGPORT }} | |
PGDATABASE: ${{ secrets.PGDATABASE }} | |
PGUSER: ${{ secrets.PGUSER }} | |
PGPASSWORD: ${{ secrets.PGPASSWORD }} | |
PGTABLENAME: ${{ secrets.PGTABLENAME }} | |
CDK_CERTIFICATE_ARN: ${{ vars.CDK_CERTIFICATE_ARN }} | |
CDK_DEFAULT_ACCOUNT: ${{ vars.CDK_DEFAULT_ACCOUNT }} | |
CDK_DEFAULT_REGION: ${{ vars.CDK_DEFAULT_REGION }} | |
CDK_DOMAIN_NAME: ${{ vars.CDK_DOMAIN_NAME }} | |
run: cdk destroy --require-approval never | |
- name: Find Comment | |
uses: peter-evans/find-comment@v3 | |
id: find-comment | |
if: ${{ github.event.pull_request.number }} | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: "github-actions[bot]" | |
body-includes: "PR Deployment Details:" | |
- name: Create or update comment with removal confirmation | |
uses: peter-evans/create-or-update-comment@v4 | |
if: ${{ github.event.pull_request.number }} | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
body: | | |
Removed PR Preview Environment. | |
edit-mode: append |