-
Notifications
You must be signed in to change notification settings - Fork 8
141 lines (120 loc) · 3.81 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
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
name: 'Bump version'
outputs:
newTag: ${{ steps.version-bump.outputs.newTag }}
environment:
name: mainnet
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
id: 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'
aws:
runs-on: ubuntu-latest
name: 'Publish to AWS'
needs: [bump]
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: Tests pass
run: yarn test
- name: Build the app
env:
VERSION: ${{ needs.bump.outputs.newTag }}
run: yarn build
- 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/tokens-list
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 }}
ipfs:
runs-on: ubuntu-latest
name: 'Publish to IPFS'
needs: [bump]
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: Tests pass
run: yarn test
- name: Build the app
env:
VERSION: ${{ needs.bump.outputs.newTag }}
run: yarn build
- name: Pin to IPFS
id: upload
uses: anantaramdas/[email protected]
with:
pin-name: JediSwap Default Token List ${{ needs.bump.outputs.newTag }}
path: "./build/jediswap-default.tokenlist.json"
pinata-api-key: ${{ secrets.PINATA_API_KEY }}
pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }}
# TODO: uncomment after updating secrets
# - name: Check Concatenation
# run: echo "dnslink=/ipfs/${{ steps.upload.outputs.hash }}"
#
# - name: Update DNS with new IPFS hash
# uses: Roosterfish/aws-route53-record-set-action@master
# with:
# aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws_route53_hosted_zone_id: ${{ secrets.AWS_ROUTE53_HOSTED_ZONE_ID }}
# aws_route53_rr_action: "UPSERT"
# aws_route53_rr_name: "_dnslink.tokens.jediswap.xyz"
# aws_route53_rr_type: "TXT"
# aws_route53_rr_ttl: "300"
# aws_route53_rr_value: '"dnslink=/ipfs/${{ steps.upload.outputs.hash }}"'