This repository was archived by the owner on Mar 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (66 loc) · 2 KB
/
docs-build-deploy.yaml
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
# on any Github Release, build and deploy docusaurus documentation
name: docs-build-deploy
on:
push:
branches:
- "main"
pull_request:
branches:
- "**"
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
working-directory: ./docs
- run: npm run build --if-present
working-directory: ./docs
- name: Write version file
working-directory: docs
run: |
# write version info to artifact
echo "Built from GitHub repo ${{ github.repository }} version ${GITHUB_SHA::7}" > ./build/version.txt
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: bubbly-docs
path: ./docs/build/
retention-days: 1
deploy:
needs: [build]
runs-on: ubuntu-latest
# only run on main branch
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
steps:
- uses: actions/download-artifact@v2
with:
name: bubbly-docs
path: ./docs
- name: Write deploy variables
id: vars
run: |
# set the deploy_env
if [ "${{ github.event_name }}" == "release" ]
then
echo "::set-output name=deploy_env::prod"
else
echo "::set-output name=deploy_env::staging"
fi
- name: Dump deployment variables
run: echo "${{ steps.vars.outputs.deploy_env }}"
- uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GCP_STORAGE_KEY }}
export_default_credentials: true
- name: Publish Documentation
run: gsutil -m rsync -r -c -d ./docs gs://${{ steps.vars.outputs.deploy_env }}-website-storage