Skip to content

Commit 7578279

Browse files
automation runner for docs
1 parent caeaf45 commit 7578279

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

.github/workflows/main.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Release on CloudFront
2+
on:
3+
push:
4+
branches:
5+
- "master"
6+
- "dev"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
env:
12+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
13+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
14+
CI: false
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
submodules: true
20+
21+
- uses: actions/setup-node@v2
22+
with:
23+
node-version: 16
24+
registry-url: https://npm.pkg.github.com/
25+
26+
- name: Grant @cocrafts package access
27+
run: |
28+
echo "@cocrafts:registry=https://npm.pkg.github.com/" >> .npmrc
29+
echo "//npm.pkg.github.com/:_authToken=${{ secrets.PACKAGE_TOKEN }}" >> .npmrc
30+
31+
- name: Set branch name
32+
id: branch
33+
run: echo "::set-output name=BRANCH_NAME::${GITHUB_REF##*/}"
34+
35+
- name: Install @metacraft/cli
36+
run: npm i --location=global @metacraft/cli
37+
38+
- name: Install dependencies
39+
run: yarn
40+
41+
- name: Generate Terraform script
42+
run: yarn gen ${GITHUB_REF##*/}
43+
44+
- name: Setup Terraform
45+
uses: hashicorp/setup-terraform@v1
46+
with:
47+
terraform_wrapper: false
48+
49+
- name: Terraform Init
50+
id: init
51+
run: terraform init
52+
53+
- name: Terraform Apply
54+
run: terraform apply -auto-approve
55+
56+
- name: Extract Terraform output
57+
run: echo $(terraform output -json) > tf-output.json
58+
59+
- name: Build
60+
run: metacraft bundle
61+
62+
- uses: shallwefootball/s3-upload-action@master
63+
with:
64+
aws_bucket: "metacraft-docs-${{ steps.branch.outputs.BRANCH_NAME }}"
65+
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
66+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
67+
source_dir: metacraft
68+
destination_dir: ''
69+
70+
- name: Invalidate CloudFront cache
71+
run: yarn invalidate ${GITHUB_REF##*/}

assets/index.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html lang="en">
33
<head>
44
<title>Metacraft Docs</title>
5+
<meta charset="UTF-8">
56
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
67
<meta name="format-detection" content="telephone=no">
78
<meta name="msapplication-tap-highlight" content="no">

0 commit comments

Comments
 (0)