Skip to content

Migrate frontend from node-specific Codecov uploader library to Github Action #9

Migrate frontend from node-specific Codecov uploader library to Github Action

Migrate frontend from node-specific Codecov uploader library to Github Action #9

name: "Feature branch Nuke"
on:
pull_request:
types:
- closed
workflow_call:
inputs:
prNumber:
required: true
type: string
githubRef:
required: true
type: string
gitSha:
required: true
type: string
secrets:
AWS_ACCOUNT_ID:
required: true
GH_AWS_ACCESS_KEY_ID:
required: true
GH_AWS_SECRET_ACCESS_KEY:
required: true
jobs:
nuke:
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.base.ref, 'feat/') == true
steps:
- uses: actions/checkout@v2
- id: synth
name: Synth cdk8s manifests
run: |-
cd k8s
yarn install --frozen-lockfile
# Feature Branch nuke set-up
export DEPLOY_TO_FEATURE_BRANCH=true
export RELEASE_NAME=${REPOSITORY#*/}-pr-$PR_NUMBER
# Export RELEASE_NAME as an output
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_OUTPUT
yarn build
env:
PR_NUMBER: ${{ inputs.prNumber }}
GIT_REF: ${{ inputs.githubRef }}
GIT_SHA: ${{ inputs.gitSha }}
REPOSITORY: ${{ github.repository }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
- name: Nuke
run: |-
aws eks --region us-east-1 update-kubeconfig --name production --role-arn arn:aws:iam::${AWS_ACCOUNT_ID}:role/kubectl
# Get repo name from synth step
RELEASE_NAME=${{ steps.synth.outputs.RELEASE_NAME }}
# Delete all non-certificate resources
kubectl delete -f k8s/dist/ -l app.kubernetes.io/part-of=$RELEASE_NAME
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.GH_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }}