-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (82 loc) · 3.02 KB
/
release.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
84
85
86
87
88
89
90
91
92
93
94
---
name: Release
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'main'
jobs:
release:
uses: codingones/github-actions-workflows/.github/workflows/semantic-release.yml@main
with:
package-manager: 'yarn'
install-dependencies-command: 'yarn install --frozen-lockfile'
cache-dependency-path: 'yarn.lock'
secrets:
PAT: ${{ secrets.PAT }}
deploy-artifact-to-s3:
needs:
- release
name: Generate and deploy artifact to s3
runs-on: ubuntu-latest
steps:
- name: Checkout client-application repository
uses: actions/checkout@v3
# TODO Better way to manage env generation
- name: Release (Generate environment.ts file)
run: |
echo "export const ENV = {
auth: {
clientId: '${{ vars.COGNITO_APP_INTEGRATION_ID }}'
}
};" > src/environments/environment.ts
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: |
yarn build client
# TODO Convert this into a semantic-release step one day
- name: Deploy
uses: kersvers/s3-sync-with-cloudfront-invalidation@v1.0.0
with:
args: --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ vars.CLOUDFRONT_S3_BUCKET }}
DISTRIBUTION_ID: ${{ vars.CLOUDFRONT_DISTRIBUTION_ID }}
SOURCE_DIR: 'dist/client'
notify-on-error:
needs:
- deploy-artifact-to-s3
- release
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
uses: codingones/github-actions-workflows/.github/workflows/notify-discord.yml@main
with:
bot-username: Failures Bot
notification-content: 'A release has failed for ${{ github.repository }} this should not happen, invest some time in your CI/CD ?'
embed-title: Go to the workflow
embed-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_FAILURES_WEBHOOK }}
notify-on-success:
needs:
- deploy-artifact-to-s3
- release
if: ${{ always() && needs.release.result == 'success' && needs.deploy-artifact-to-s3.result == 'success' }}
uses: codingones/github-actions-workflows/.github/workflows/notify-discord.yml@main
with:
bot-username: Releases Bot
notification-content: 'A new ${{ github.repository }} version: ${{ needs.release.outputs.version }} has been released ! :tada:'
embed-title: Go to the changelog
embed-url: https://github.com/${{ github.repository }}/blob/main/docs/CHANGELOG.md
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASES_WEBHOOK }}