-
Notifications
You must be signed in to change notification settings - Fork 12
81 lines (66 loc) · 2.74 KB
/
deposits_data_cronjob.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
name: Update deposits data
on:
schedule:
# https://crontab.guru/#0_9_*_*_*
# Every day at 9am UTC
- cron: "0 9 * * *"
workflow_dispatch:
jobs:
deploy:
name: Deployment
runs-on: ubuntu-latest
outputs:
tag: ${{steps.latest_tag.outputs.tag}}
steps:
# Ref: https://github.com/actions/checkout/issues/1471#issuecomment-1771231294
- uses: actions/checkout@v4
- uses: oprypin/find-latest-tag@v1
with:
repository: gnosischain/gbc-deposit-ui
releases-only: true
prefix: 'v'
id: latest_tag
- name: Tag checkout
run: |
git fetch --prune --unshallow --tags
echo "Checking out tag ${{ steps.latest_tag.outputs.tag }}"
git checkout ${{ steps.latest_tag.outputs.tag }}
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Setup Node.js
uses: actions/setup-node@v2
- name: Install
run: |
rm -rf .cache
rm -rf build
yarn config set cache-folder .yarn
yarn install
pip install awscli --upgrade --user
- name: Build deposits map
run: yarn update-deposits
- name: Configure AWS Production credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.PROD_AWS_DEFAULT_REGION }}
# Script to deploy to release environment
- name: 'Deploy to S3: Release'
run: |
aws s3 sync data s3://${{ secrets.RELEASE_BUCKET_NAME }}/data --delete
- name: 'Cloudfront: cache invalidation'
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.PROD_AWS_CLOUDFRONT_ID }} --paths "/data/*"
notify:
uses: ./.github/workflows/slack_release_notification.yml
if: ${{ always() }}
needs: deploy
secrets:
RELEASES_SLACK_WEBHOOK_URL: ${{ secrets.RELEASES_SLACK_WEBHOOK_URL }}
with:
environment: Production
service: GC Deposit UI - Update Deposits
success: ${{ contains(join(needs.*.result, ','), 'success') }}
message: "deploy service `GC Deposit UI - Update Deposits data` based on version `${{ needs.deploy.outputs.tag }}`. Triggered by `${{ github.actor }}`."