This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
feat: ✨ add filtering by GE and additional aggregation operations #20
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
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json | |
--- | |
name: Destroy CloudFormation stacks and staging environment for pull request | |
on: | |
pull_request: | |
types: | |
- closed | |
- labeled | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
deployments: write | |
repository-projects: write | |
env: | |
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_REGION: us-east-1 | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
CERTIFICATE_ARN: ${{ secrets.CERTIFICATE_ARN }} | |
DATABASE_URL: ${{ secrets.DATABASE_URL_STAGING }} | |
HOSTED_ZONE_ID: ${{ secrets.HOSTED_ZONE_ID }} | |
NODE_ENV: staging | |
PR_NUM: ${{ github.event.pull_request.number }} | |
jobs: | |
destroy-api: | |
name: Destroy API CloudFormation stack and staging environment for pull request | |
if: (github.event.action == 'labeled' && github.event.label.name == 'no deploy') || github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
- name: Setup Node.js and pnpm | |
uses: ./.github/actions/setup-node-and-pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build AntStack | |
run: pnpm build --filter="ant-stack" | |
- name: Link AntStack | |
run: pnpm link ant-stack | |
# Do not remove this step, as the API assets are required for `cdk destroy` to work properly. | |
- name: Build API assets | |
run: pnpm build --filter="api-*" | |
- name: Wait for API CloudFormation stack to idle | |
uses: ./.github/actions/wait-for-cloudformation-stack-idle | |
with: | |
stack_name: peterportal-api-next-staging-${{ github.event.pull_request.number }} | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }} | |
- name: Destroy API CloudFormation stack | |
run: pnpm destroy --filter="ant-stack" | |
- name: Set API staging environment to inactive | |
uses: strumwolf/delete-deployment-environment@195215d2c5602aee6fb4b9cf0853970decca9e7a # v2.3.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: staging-${{ github.event.pull_request.number }} | |
onlyDeactivateDeployments: true | |
destroy-documentation: | |
name: Destroy documentation CloudFormation stack and staging environment for pull request | |
if: (github.event.action == 'labeled' && github.event.label.name == 'no deploy') || github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
- name: Setup Node.js and pnpm | |
uses: ./.github/actions/setup-node-and-pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build documentation CDK | |
run: pnpm build --filter="docs-cdk" | |
- name: Wait for documentation CloudFormation stack to idle | |
uses: ./.github/actions/wait-for-cloudformation-stack-idle | |
with: | |
stack_name: peterportal-api-next-docs-staging-${{ github.event.pull_request.number }} | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }} | |
- name: Destroy documentation CloudFormation stack | |
run: pnpm destroy --filter="docs-cdk" | |
- name: Set documentation staging environment as inactive | |
uses: strumwolf/delete-deployment-environment@195215d2c5602aee6fb4b9cf0853970decca9e7a # v2.3.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: staging-${{ github.event.pull_request.number }}-docs | |
onlyDeactivateDeployments: true |