Skip to content

v4.53.6

v4.53.6 #470

Workflow file for this run

name: Deploy release
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
required: true
type: string
default: v4.8.7
description: Release version
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
issues: write
contents: write
env:
HUSKY: 0
RELEASE_VERSION: ${{ github.event.inputs.version || github.ref_name }}
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
jobs:
deploy:
timeout-minutes: 90
runs-on: ubuntu-latest
environment: aws-cdk
strategy:
matrix:
config:
- app-type: non-cdk
deploy-tag-suffix: non-cdk-deployed
exclude-pattern: 'tag:cdk'
extra-deploy-args: ''
- app-type: cdk
deploy-tag-suffix: cdk-deployed
exclude-pattern: '*,!tag:cdk'
extra-deploy-args: '-- --require-approval=never'
steps:
- run: echo "Release process starting for ${{ matrix.config.app-type }} apps version ${{ env.RELEASE_VERSION }}"
- uses: actions/checkout@v4
name: 'Checkout version tagged branch'
with:
ref: ${{ env.RELEASE_VERSION }}
fetch-depth: 0
fetch-tags: true
- name: Install Deps
uses: ./.github/actions/install-deps
- name: Find previous deployment tag
id: previous_deployment
run: |
echo "Determining SHAs for affected projects"
PREVIOUS_DEPLOYMENT=$(git describe --tags --abbrev=0 --match="*-${{ matrix.config.deploy-tag-suffix }}")
echo "Previous release: $PREVIOUS_DEPLOYMENT"
echo "NX_BASE=$PREVIOUS_DEPLOYMENT" >> $GITHUB_ENV
echo "NX_HEAD=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Show affected projects
run: |
AFFECTED_PROJECTS=$(npx nx show projects --affected -t deploy --exclude='${{ matrix.config.exclude-pattern }}')
triggerRelease=$([[ -z $AFFECTED_PROJECTS ]] && echo "false" || echo "true")
echo "Trigger release: $triggerRelease for ${AFFECTED_PROJECTS}"
echo "triggerRelease=$triggerRelease" >> $GITHUB_ENV
echo "$([[ -z $AFFECTED_PROJECTS ]] && echo 'No deployable projects affected.' || echo 'Deployable projects affected. Start deployment!!!')" >> $GITHUB_STEP_SUMMARY
- name: Deploy Apps
if: success() && env.triggerRelease == 'true'
run: npx nx affected --target=deploy --exclude='${{ matrix.config.exclude-pattern }}' ${{ matrix.config.extra-deploy-args}}
- name: Tag deployment success
# only run if deploy apps was not skipped
if: success() && env.triggerRelease == 'true'
run: |
git config --global user.email "github-actions[bot]@users.no-reply.github.com"
git config --global user.name "github-actions[bot]"
DEPLOY_TAG=$RELEASE_VERSION-${{ matrix.config.deploy-tag-suffix }}
git tag -a "$DEPLOY_TAG" $GITHUB_SHA -m "Version $RELEASE_VERSION deployed ${{ matrix.config.app-type }} apps successfully"
git push origin --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Issue
if: failure()
run: |
gh issue create \
--title "bug(deploy): Deploy release ${{ env.RELEASE_VERSION }} for ${{ matrix.config.app-type }} apps failed" \
--body "GitHub [Deploy release workflow](${{ github.event.html_url }})" \
--label "bug" \
--assignee "${{ github.actor }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}