-
Notifications
You must be signed in to change notification settings - Fork 24
149 lines (128 loc) · 4.06 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Automated Version Bump
uses: phips28/[email protected]
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 }}
sentry-release:
runs-on: ubuntu-latest
needs: [ cleanup ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install Dependencies
run: |
export NODE_OPTIONS=--max_old_space_size=8192
yarn install --immutable
- name: Build Project for Sentry
run: yarn build-with-source-maps
env:
CI: false
RELEASE_TYPE: 'PRODUCTION'
GENERATE_SOURCEMAPS: true
NODE_OPTIONS: '--max-old-space-size=4096'
- name: Get package info
id: package
uses: codex-team/[email protected]
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
sourcemaps: "./dist"
version: ${{ steps.package.outputs.version }}
url_prefix: '~'
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: 18
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Build Project
run: yarn production-build
env:
CI: false
RELEASE_TYPE: 'PRODUCTION'
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets[format('AWS_ACCESS_KEY_ID_{0}', 'PRODUCTION')] }}
aws-secret-access-key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', 'PRODUCTION')] }}
aws-region: us-east-1
- name: Deploy app build to S3 bucket
run: aws s3 sync ./dist/ s3://$BUCKET_NAME
env:
BUCKET_NAME: ${{ secrets[format('AWS_S3_BUCKET_NAME_{0}', 'PRODUCTION')] }}
- name: Run Cache Invalidation
run: aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths /\*
env:
CDN_DISTRIBUTION_ID: ${{ secrets[format('AWS_CDN_DISTRIBUTION_ID_{0}', 'PRODUCTION')] }}