Skip to content

cd

cd #2

Workflow file for this run

name: cd
on:
workflow_dispatch:
workflow_call:
concurrency:
# Only allow for one action to run at once, queue any others
group: cd
# Don't cancel existing
cancel-in-progress: false
env:
TF_VAR_project_registry_auth_token: ${{ secrets.PROJECT_REGISTRY_AUTH_TOKEN }}
TF_VAR_secret: ${{ secrets.SECRET }}
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.clean_version.outputs.version }}
steps:
- id: latest_release
uses: pozetroninc/github-action-get-latest-release@master
if: github.event_name != 'release'
with:
repository: ${{ github.repository }}
excludes: draft
- id: get
uses: actions/github-script@v6
env:
LATEST_TAG: ${{ steps.latest_release.outputs.release }}
with:
result-encoding: string
script: |
if (context.eventName == "release") {
return context.payload.release.tag_name
} else {
return process.env.LATEST_TAG
}
- id: clean_version
run: |
version=$(echo "${{ steps.get.outputs.result }}" | sed 's/v//g')
echo "version=$version" >> $GITHUB_OUTPUT
deploy-infra-staging:
runs-on: ubuntu-latest
environment:
name: staging
url: https://verify.walletconnect.com/health
needs:
- get-version
steps:
- name: Checkout
uses: actions/checkout@v3
- id: deploy-staging
uses: WalletConnect/actions/actions/deploy-terraform/@v2
env:
TF_VAR_image_version: ${{ needs.get-version.outputs.version }}
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
environment: staging
app-name: ${{ github.event.repository.name }}
validate-staging:
needs: [deploy-infra-staging]
uses: ./.github/workflows/validate.yml
with:
environment: 'staging'
deploy-infra-prod:
runs-on: ubuntu-latest
environment:
name: prod
url: https://verify.walletconnect.com/health
needs:
- get-version
- validate-staging
steps:
- name: Checkout
uses: actions/checkout@v3
- id: deploy-staging
uses: WalletConnect/actions/actions/deploy-terraform/@v2
env:
TF_VAR_image_version: ${{ needs.get-version.outputs.version }}
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
environment: prod
app-name: ${{ github.event.repository.name }}