Skip to content

Release / feat: geo-blocking (#141) #17

Release / feat: geo-blocking (#141)

Release / feat: geo-blocking (#141) #17

name: ⚡ Release
run-name: 'Release / ${{ github.event.head_commit.message }}'
on:
push:
branches:
- master
paths-ignore:
- '.github/**'
- 'docs/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE'
- 'justfile'
- 'rustfmt.toml'
- '.editorconfig'
- '.pre-commit-config.yaml'
- '.terraformignore'
- '.env.example'
concurrency: deploy
permissions:
contents: write
id-token: write
packages: write
jobs:
# We skip the CI part here since it must have already run thanks to branch protection.
paths_filter:
name: Paths Filter
runs-on:
group: ${{ vars.RUN_GROUP }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
infra:
- '${{ vars.TF_DIRECTORY }}/**'
app:
- 'src/**'
outputs:
infra: ${{ steps.filter.outputs.infra }}
app: ${{ steps.filter.outputs.app }}
update_version:
name: Update Version
runs-on:
group: ${{ vars.RUN_GROUP }}
if: ${{ needs.paths_filter.outputs.app == 'true' }}
needs: [paths_filter]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.RELEASE_PAT }}
fetch-depth: 0
- name: Release
id: release
uses: WalletConnect/actions/github/update-rust-version/@2.1.4
with:
token: ${{ secrets.RELEASE_PAT }}
outputs:
version: ${{ steps.release.outputs.version }}
released_version:
name: Release Version ➠ ${{ needs.update_version.outputs.version }}
runs-on:
group: ${{ vars.RUN_GROUP }}
needs: [ update_version ]
steps:
- run: echo "Version = ${{ needs.update_version.outputs.version }}"
publish_image-staging:
name: Publish ${{ needs.update_version.outputs.version }} ❱❱ Staging ECR
uses: ./.github/workflows/sub-publish-image.yml
needs: [ update_version ]
with:
version: ${{ needs.update_version.outputs.version }}
aws-role-arn: ${{ vars.AWS_ROLE_STAGING }}
publish_image-prod:
name: Publish ${{ needs.update_version.outputs.version }} ❱❱ Prod ECR
uses: ./.github/workflows/sub-publish-image.yml
needs: [ update_version ]
with:
version: ${{ needs.update_version.outputs.version }}
aws-role-arn: ${{ vars.AWS_ROLE_PROD }}
get_version:
name: Get Version
runs-on:
group: ${{ vars.RUN_GROUP }}
needs: [ paths_filter, update_version, publish_image-staging, publish_image-prod ]
if: ${{ always() && !cancelled() && !failure() }}
steps:
- name: Get task definition from ECS
id: get_task
if: ${{ needs.paths_filter.outputs.app != 'true' }}
uses: WalletConnect/actions/aws/ecs/get-task-image/@2.1.4
with:
aws-role-arn: ${{ vars.AWS_ROLE_STAGING }}
aws-region: ${{ vars.AWS_REGION }}
task-definition-name: ${{ vars.IMAGE_NAME }}
container-name: ${{ vars.IMAGE_NAME }}
- name: Get target version
id: get_target_version
run: |
if [ "${{ needs.paths_filter.outputs.app }}" == "true" ]; then
echo "version=${{ needs.update_version.outputs.version }}" >> "$GITHUB_OUTPUT"
else
echo "version=${{ steps.get_task.outputs.tag }}" >> "$GITHUB_OUTPUT"
fi
outputs:
version: ${{ steps.get_target_version.outputs.version }}
used_version:
name: Version ➠ ${{ needs.get_version.outputs.version }}
if: ${{ always() && !cancelled() && !failure() }}
runs-on:
group: ${{ vars.RUN_GROUP }}
needs: [ get_version ]
steps:
- run: echo "Version = ${{ needs.get_version.outputs.version }}"
cd:
name: CD
uses: ./.github/workflows/sub-cd.yml
if: ${{ always() && !cancelled() && !failure() }}
needs: [paths_filter, get_version, publish_image-staging, publish_image-prod]
secrets: inherit
with:
deploy-infra: ${{ needs.paths_filter.outputs.infra == 'true' }}
deploy-app: ${{ needs.paths_filter.outputs.app == 'true' && needs.paths_filter.outputs.infra != 'true' }}
deploy-prod: true
version: ${{ needs.get_version.outputs.version }}