-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (72 loc) · 2.64 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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: 45
runs-on: ubuntu-latest
environment: aws-cdk
steps:
- run: echo "Release process starting for 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="*deployed")
echo "Previous release: $PREVIOUS_DEPLOYMENT"
echo "NX_BASE=$PREVIOUS_DEPLOYMENT" >> $GITHUB_ENV
echo "NX_HEAD=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Show affected projects
run: echo "Affected projects = $(npx nx show projects --affected -t deploy)"
- name: Deploy CDK Apps
run: |
npx nx affected --target=deploy --exclude='*,!tag:cdk' -- --all --require-approval=never
npx nx affected --target=deploy --exclude='tag:cdk'
- name: Tag deployment success
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
git tag -a "$DEPLOY_TAG-deployed" $GITHUB_SHA -m "Version $RELEASE_VERSION deployed 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 }} failed" \
--body "GitHub [Deploy release workflow](${{ github.event.html_url }})" \
--label "bug" \
--assignee "${{ github.actor }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}