This repository was archived by the owner on Feb 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (94 loc) · 3.14 KB
/
merge.yaml
File metadata and controls
102 lines (94 loc) · 3.14 KB
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: 'Terraform on Merge'
on:
push:
branches:
- main
jobs:
terraform:
name: 'Run Terraform on Merge'
runs-on: ubuntu-latest
env:
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create branch workspace
uses: dflook/terraform-new-workspace@v1
with:
workspace: mpc
path: terraform
- name: Deploy infrastrucutre
uses: dflook/terraform-apply@v1
id: test-infra
with:
path: terraform
variables: |
BRANCH = "main"
COMMITHASH = "${{ github.sha }}"
AUTH_KEY = "${{ secrets.AUTH_KEY }}"
workspace: mpc
auto_approve: true
- name: Set up S3cmd cli tool
uses: s3-actions/s3cmd@v1.2.0
with:
provider: aws # default is linode
region: 'eu-west-2'
access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Copy first contribution to new branch folder
run: |
s3cmd sync circuits/* s3://mpc-main --exclude="*.r1cs" --exclude="*.ptau"
browser:
strategy:
matrix:
node-version: [16.x]
needs: terraform
runs-on: ubuntu-latest
name: Build and deploy browser
env:
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: browser/package-lock.json
- run: npm ci
working-directory: browser
- run: |
npm i browserify
- run: |
npm run build
env:
REACT_APP_BRANCH: main
working-directory: browser
- name: Set up S3cmd cli tool
uses: s3-actions/s3cmd@v1.2.0
with:
provider: aws # default is linode
region: 'eu-west-2'
access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Copy first contribution to new branch folder
run: |
s3cmd sync build/* s3://mpc-main/website/
working-directory: browser
- name: Get outputs
uses: dflook/terraform-output@v1
id: tf-outputs
with:
path: terraform
workspace: mpc
- name: Invalidate CloudFront
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ steps.tf-outputs.outputs.distribution_id }}
PATHS: '/*'
AWS_REGION: 'eu-west-3'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}