Repository navigation
71 lines (57 loc) · 1.89 KB
/
Copy pathmain.yml
File metadata and controls
71 lines (57 loc) · 1.89 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
name: Release on CloudFront
on:
push:
branches:
- "master"
- "dev"
jobs:
release:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CI: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
- name: Grant @cocrafts package access
run: |
echo "@cocrafts:registry=https://npm.pkg.github.com/" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.PACKAGE_TOKEN }}" >> .npmrc
- name: Set branch name
id: branch
run: echo "::set-output name=BRANCH_NAME::${GITHUB_REF##*/}"
- name: Install @metacraft/cli
run: npm i --location=global @metacraft/cli
- name: Install dependencies
run: yarn
- name: Generate Terraform script
run: yarn gen ${GITHUB_REF##*/}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_wrapper: false
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Apply
run: terraform apply -auto-approve
- name: Extract Terraform output
run: echo $(terraform output -json) > tf-output.json
- name: Build
run: metacraft bundle
- uses: shallwefootball/s3-upload-action@master
with:
aws_bucket: "metacraft-docs-${{ steps.branch.outputs.BRANCH_NAME }}"
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
source_dir: metacraft
destination_dir: ''
- name: Invalidate CloudFront cache
run: yarn invalidate ${GITHUB_REF##*/}