Skip to content

Commit b518ef3

Browse files
ci: Add S3 deploy workflow for main and prod branches
Pushes to main deploy to the next release version folder (e.g. /96/website/) and pushes to prod deploy to the current production version folder (e.g. /95/website/). Version is determined dynamically from the ContentService database version endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8297673 commit b518ef3

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy to S3
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- prod
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: npm
24+
25+
- name: Determine version and base href
26+
id: version
27+
run: |
28+
PROD_VERSION=$(curl -sf https://reactome.org/ContentService/data/database/version)
29+
echo "prod_version=$PROD_VERSION" >> "$GITHUB_OUTPUT"
30+
31+
if [ "${{ github.ref_name }}" = "prod" ]; then
32+
VERSION=$PROD_VERSION
33+
else
34+
VERSION=$((PROD_VERSION + 1))
35+
fi
36+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
37+
echo "Deploying to version $VERSION"
38+
39+
- name: Install dependencies
40+
run: npm ci
41+
42+
- name: Build
43+
run: npx ng build reactome --configuration production --base-href /${{ steps.version.outputs.version }}/website/
44+
45+
- name: Configure AWS credentials
46+
uses: aws-actions/configure-aws-credentials@v4
47+
with:
48+
role-to-assume: ${{ vars.AWS_ROLE }}
49+
aws-region: us-east-1
50+
51+
- name: Deploy to S3
52+
run: |
53+
aws s3 sync dist/reactome/browser/ \
54+
s3://${{ vars.S3_BUCKET }}/${{ steps.version.outputs.version }}/website/ \
55+
--delete
56+
57+
- name: Invalidate CloudFront cache
58+
run: |
59+
aws cloudfront create-invalidation \
60+
--distribution-id E2WMIF8KN88WPK \
61+
--paths "/${{ steps.version.outputs.version }}/website/*"

0 commit comments

Comments
 (0)