Release Candidate Deploy #44
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: 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | |
with: | |
ref: release-candidate | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # 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: Build frontend | |
run: NODE_ENV=production yarn build | |
env: | |
EMBEDLY_KEY: ${{ secrets.EMBEDLY_KEY_RC }} | |
MITOPEN_AXIOS_WITH_CREDENTIALS: true | |
MITOPEN_AXIOS_BASE_PATH: https://api.mitopen-rc.odl.mit.edu | |
- 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' |