-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (92 loc) · 3.93 KB
/
release-candidate.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
95
96
97
98
99
100
101
102
name: Release Candidate Deploy
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [release-candidate]
workflow_dispatch: # manual trigger
jobs:
# runs if CI workflow was successful OR if this was manually triggered
on-success:
runs-on: ubuntu-22.04
if: >
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: release-candidate
- name: Set VERSION
run: echo "VERSION=$(./scripts/get_version.sh)" >> $GITHUB_ENV
- name: Heroku login
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:login
- name: Release Backend on Heroku
uses: akhileshns/heroku-deploy@e86b991436e126ff9d78399b801a6610a64881c9
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: mitopen-rc
heroku_email: ${{ secrets.HEROKU_EMAIL }}
branch: release-candidate
- name: Write commit SHA to file
run: echo $GITHUB_SHA > frontends/main/public/hash.txt
- name: Build and push the NextJS Docker image
env:
HEROKU_APP_NAME: mitopen-rc-nextjs
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
ORIGIN: https://next.rc.learn.mit.edu
MITOL_API_BASE_URL: https://api.rc.learn.mit.edu
SITE_NAME: MIT Learn
SUPPORT_EMAIL: [email protected]
EMBEDLY_KEY: ${{ secrets.EMBEDLY_KEY_RC }}
MITOL_AXIOS_WITH_CREDENTIALS: true
CSRF_COOKIE_NAME: ${{ secrets.CSRF_COOKIE_NAME_RC }}
POSTHOG_API_HOST: https://app.posthog.com
POSTHOG_PROJECT_ID: ${{ secrets.POSTHOG_PROJECT_ID_RC }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY_RC }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN_RC }}
SENTRY_ENV: ${{ secrets.MITOL_ENVIRONMENT_RC }}
SENTRY_PROFILES_SAMPLE_RATE: ${{ secrets.SENTRY_PROFILES_SAMPLE_RATE_RC }}
SENTRY_TRACES_SAMPLE_RATE: ${{ secrets.SENTRY_TRACES_SAMPLE_RATE_RC }}
APPZI_URL: ${{ secrets.APPZI_URL_RC }}
VERSION: ${{ github.sha }}
run: |
heroku container:push web \
--app $HEROKU_APP_NAME \
--recursive \
--arg NEXT_PUBLIC_ORIGIN=$ORIGIN,\
NEXT_PUBLIC_MITOL_API_BASE_URL=$MITOL_API_BASE_URL,\
NEXT_PUBLIC_SITE_NAME="$SITE_NAME",\
NEXT_PUBLIC_MITOL_SUPPORT_EMAIL=$SUPPORT_EMAIL,\
NEXT_PUBLIC_EMBEDLY_KEY=$EMBEDLY_KEY,\
NEXT_PUBLIC_MITOL_AXIOS_WITH_CREDENTIALS=$MITOL_AXIOS_WITH_CREDENTIALS,\
NEXT_PUBLIC_CSRF_COOKIE_NAME=$CSRF_COOKIE_NAME,\
NEXT_PUBLIC_POSTHOG_API_HOST=$POSTHOG_API_HOST,\
NEXT_PUBLIC_POSTHOG_PROJECT_ID=$POSTHOG_PROJECT_ID,\
NEXT_PUBLIC_POSTHOG_API_KEY=$POSTHOG_API_KEY,\
NEXT_PUBLIC_SENTRY_DSN=$SENTRY_DSN,\
NEXT_PUBLIC_SENTRY_ENV=$SENTRY_ENV,\
NEXT_PUBLIC_SENTRY_PROFILES_SAMPLE_RATE=$SENTRY_PROFILES_SAMPLE_RATE,\
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE=$SENTRY_TRACES_SAMPLE_RATE,\
NEXT_PUBLIC_APPZI_URL=$APPZI_URL,\
NEXT_PUBLIC_VERSION=$VERSION \
--context-path .
- name: Release Frontend on Heroku
env:
HEROKU_APP_NAME: mitopen-rc-nextjs
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:release --app $HEROKU_APP_NAME web
- name: Purge Fastly cache
uses: jcoene/fastly-purge-action@master
with:
api_key: "${{ secrets.FASTLY_API_KEY_RC_NEXTJS }}"
service_id: "${{ secrets.FASTLY_SERVICE_ID_RC_NEXTJS }}"
# runs ONLY on a failure of the CI workflow
on-failure:
runs-on: ubuntu-22.04
if: >
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'failure'
steps:
- run: echo 'The triggering workflow failed'