Release / feat: fetch the list of OFAC blocked countries from GitHub variables (#163) #51
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: ⚡ Release | |
run-name: 'Release / ${{ github.event.head_commit.message }}' | |
on: | |
push: | |
branches: | |
- main | |
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 | |
checks: 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.5 | |
with: | |
token: ${{ secrets.RELEASE_PAT }} | |
outputs: | |
version: ${{ steps.release.outputs.version }} | |
released_version: | |
name: Version ➠ ${{ needs.update_version.outputs.version }} | |
needs: [ update_version ] | |
runs-on: | |
group: ${{ vars.RUN_GROUP }} | |
steps: | |
- run: echo "Version = ${{ needs.update_version.outputs.version }}" | |
publish_image-staging: | |
name: Publish ${{ needs.update_version.outputs.version }} ❱❱ Staging ECR | |
needs: [ update_version ] | |
uses: ./.github/workflows/sub-publish-image.yml | |
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 | |
needs: [ update_version ] | |
uses: ./.github/workflows/sub-publish-image.yml | |
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_PROD }} | |
aws-region: ${{ vars.AWS_REGION }} | |
task-definition-name: wc-${{ vars.AWS_REGION }}-prod-${{ vars.IMAGE_NAME }} | |
container-name: wc-${{ vars.AWS_REGION }}-prod-${{ 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 }} | |
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' }} | |
deploy-prod: true | |
version: ${{ needs.get_version.outputs.version }} |