-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (74 loc) · 3 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
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-latest
if: >
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
ref: release-candidate
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: "^20"
cache: yarn
cache-dependency-path: yarn.lock
- name: Setup environment
run: sudo apt-get install libelf1
- name: Install frontend dependencies
run: yarn install --immutable
- name: Set VERSION
run: echo "VERSION=$(./scripts/get_version.sh)" >> $GITHUB_ENV
- name: Build frontend
run: NODE_ENV=production yarn build
env:
EMBEDLY_KEY: ${{ secrets.EMBEDLY_KEY_RC }}
POSTHOG_ENABLED: true
POSTHOG_API_HOST: https://app.posthog.com
POSTHOG_TIMEOUT_MS: 1000
POSTHOG_PROJECT_ID: ${{ secrets.POSTHOG_PROJECT_ID_RC }}
POSTHOG_PROJECT_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY_RC }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN_RC }}
SENTRY_ENV: ${{ secrets.MITOPEN_ENV_RC }}
MITOPEN_AXIOS_WITH_CREDENTIALS: true
MITOPEN_API_BASE_URL: https://api.mitopen-rc.odl.mit.edu
MITOPEN_SUPPORT_EMAIL: [email protected]
- uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520
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/mit-open/build/static/hash.txt
- name: Upload frontend build to s3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: ol-mitopen-app-storage-rc
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_RC }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_RC }}
SOURCE_DIR: "frontends/mit-open/build" # optional: defaults to entire repository
DEST_DIR: "frontend" # This dir will get cluttered but it is okay for now
- name: Purge Fastly cache
uses: jcoene/fastly-purge-action@master
with:
api_key: "${{ secrets.FASTLY_API_KEY_RC }}"
service_id: "${{ secrets.FASTLY_SERVICE_ID_RC }}"
# runs ONLY on a failure of the CI workflow
on-failure:
runs-on: ubuntu-latest
if: >
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'failure'
steps:
- run: echo 'The triggering workflow failed'