v4.72.27 #684
Workflow file for this run
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: 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 }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
deploy: | |
timeout-minutes: 90 | |
runs-on: ubuntu-latest | |
environment: aws-cdk | |
strategy: | |
fail-fast: false | |
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 | |
if: success() && env.triggerRelease == 'true' | |
run: | | |
echo "Configuring git user" | |
git config --global user.email "github-actions[bot]@users.no-reply.github.com" | |
git config --global user.name "github-actions[bot]" | |
echo "Setting deploy tag" | |
DEPLOY_TAG=$RELEASE_VERSION-${{ matrix.config.deploy-tag-suffix }} | |
echo "Deploy tag: $DEPLOY_TAG" | |
echo "Tagging commit" | |
git tag -a "$DEPLOY_TAG" $GITHUB_SHA -m "Version $RELEASE_VERSION deployed ${{ matrix.config.app-type }} apps successfully" | |
echo "Pushing tags" | |
git push origin "$DEPLOY_TAG" | |
- 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 }}" |