-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (51 loc) · 1.63 KB
/
deploy.yml
File metadata and controls
63 lines (51 loc) · 1.63 KB
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
name: Deploy to S3
on:
push:
branches:
- main
- prod
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Determine version
id: version
run: |
PROD_VERSION=$(curl -sf https://reactome.org/ContentService/data/database/version)
echo "prod_version=$PROD_VERSION" >> "$GITHUB_OUTPUT"
if [ "${{ github.ref_name }}" = "prod" ]; then
VERSION=$PROD_VERSION
else
VERSION=$((PROD_VERSION + 1))
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Deploying to version $VERSION"
- name: Install dependencies
run: npm ci
- name: Build
run: |
npx ng build reactome-cytoscape-style
npx ng build reactome --configuration production --base-href /${{ steps.version.outputs.version }}/website/
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_ROLE }}
aws-region: us-east-1
- name: Deploy to S3
run: |
aws s3 sync dist/reactome/browser/ \
s3://${{ vars.S3_BUCKET }}/${{ steps.version.outputs.version }}/website/ \
--delete
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id E2WMIF8KN88WPK \
--paths "/${{ steps.version.outputs.version }}/website/*"