Skip to content

Commit 44580ff

Browse files
committed
chore: add testnet deployment workflow
1 parent c063a9e commit 44580ff

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Testnet Environment Deployment
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- testnet
8+
9+
jobs:
10+
deploy-production:
11+
name: Testnet Environment Deployment
12+
runs-on: ubuntu-latest
13+
environment: testnet
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Node.js setup
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '18.18.1'
22+
cache: yarn
23+
24+
- name: Yarn install package
25+
run: yarn install --frozen-lockfile
26+
27+
- name: Setting up environment variables
28+
run: |
29+
jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' <<< $SECRETS_CONTEXT > .env
30+
env:
31+
SECRETS_CONTEXT: ${{ toJson(secrets) }}
32+
33+
- name: App build
34+
id: build
35+
run: CI=false yarn run build
36+
37+
- name: AWS Credentials setup
38+
uses: aws-actions/configure-aws-credentials@v1
39+
with:
40+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
41+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
42+
aws-region: ap-southeast-1
43+
44+
- name: S3 bucket update
45+
run: |
46+
aws s3 cp --recursive --region ap-southeast-1 ./dist "s3://$AWS_S3_BUCKET_NAME/widget"
47+
env:
48+
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
49+
50+
- name: CloudFront cache update
51+
run: |
52+
aws cloudfront create-invalidation --distribution-id "$AWS_CLOUDFRONT_DISTRIBUTION_ID" --paths "/*"
53+
env:
54+
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
55+
56+
- name: Slack notification
57+
uses: 8398a7/action-slack@v3
58+
with:
59+
status: ${{ job.status }}
60+
author_name: Hippo River Widget Testnet Environment
61+
mention: '<@dj>'
62+
fields: repo,message,commit,author
63+
env:
64+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
65+
if: always()

0 commit comments

Comments
 (0)