forked from omni/tokenbridge
-
Notifications
You must be signed in to change notification settings - Fork 5
79 lines (69 loc) · 2.68 KB
/
deploy.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
name: Deploy
# Run on pushes to main or PRs
# on:
# # Pull request hook without any config. Launches for every pull request
# pull_request:
# # Launches for pushes to main or dev
# push:
# branches:
# - develop
# # Launches build when release is published
# release:
# types: [published]
on: [push]
jobs:
initialize:
runs-on: ubuntu-latest
outputs:
cache_key: ${{ steps.get_cache_key.outputs.cache_key }}
steps:
- uses: actions/setup-node@v1
with:
node-version: 12
- uses: actions/checkout@v2
with:
submodules: true
- name: Set cache key
id: get_cache_key
run: |
git submodule status > submodule.status
echo "::set-output name=cache_key::cache-repo-${{ hashFiles('yarn.lock', 'package.json', 'submodule.status') }}"
- uses: actions/cache@v2
id: cache-repo
with:
path: |
**/node_modules
contracts/build
key: ${{ steps.get_cache_key.outputs.cache_key }}
- name: Install dependencies and compile contracts
if: ${{ !steps.cache-repo.outputs.cache-hit }}
run: |
yarn run initialize
- name: yarn run build:alm
run: yarn run build
- name: Configure AWS credentials for STG
if: github.ref == 'refs/heads/develop'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
# Step to deploy to the Staging environment
- name: 'Deploy to S3: Staging'
if: github.ref == 'refs/heads/develop'
run: aws s3 sync alm/build s3://${{ secrets.AWS_STAGING_BUCKET_NAME }} --delete
# # Script to upload release files
# - name: 'Upload release build files for production'
# if: startsWith(github.ref, 'refs/tags/v')
# run: aws s3 sync public s3://${{ secrets.AWS_STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }} --delete
- name: Configure AWS credentials for PROD
if: github.ref == 'refs/heads/master'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
# Step to deploy to the production environment
- name: 'Deploy to S3: PRODUCTION'
if: github.ref == 'refs/heads/master'
run: aws s3 sync alm/build s3://${{ secrets.AWS_PROD_BUCKET_NAME }} --delete