-
Notifications
You must be signed in to change notification settings - Fork 7
109 lines (94 loc) · 2.84 KB
/
jediswap-mainnet.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Release - Mainnet
on:
workflow_dispatch:
inputs:
bumpType:
description: 'Bump version'
required: true
default: 'patch'
type: choice
options:
- 'patch'
- 'minor'
- 'major'
jobs:
bump:
runs-on: ubuntu-latest
environment:
name: mainnet
url: https://app.v2.jediswap.xyz/
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Automated Version Bump
uses: phips28/gh-action-bump-version@v9.1.4
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
version-type: ${{ inputs.bumpType }}
tag-prefix: 'v'
target-branch: 'main'
commit-message: 'CI: bumps version to {{version}}'
bump-policy: 'last-commit'
cleanup:
runs-on: ubuntu-latest
needs: [bump]
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
needs: [cleanup]
environment:
name: mainnet
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Build Project
run: yarn build
env:
CI: false
RELEASE_TYPE: 'PRODUCTION'
- name: Configure AWS
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: us-east-1
- name: Deploy app build to S3 bucket
run: aws s3 sync ./build/ s3://$BUCKET_NAME
env:
BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
- name: Run Cache Invalidation
run: aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths /\*
env:
CDN_DISTRIBUTION_ID: ${{ secrets.AWS_CDN_DISTRIBUTION_ID }}