-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (85 loc) · 3.27 KB
/
Copy pathhelp-center.yml
File metadata and controls
101 lines (85 loc) · 3.27 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
name: help center build&deploy
on:
push:
branches:
- "main"
tags:
- "*"
workflow_dispatch:
inputs:
env:
description: environment
default: dev
required: true
jobs:
help-center-build:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: setup env if it is trigger by push
if: ${{ github.event_name == 'push' }}
run: |
echo "ENVIRONMENT=dev" >> $GITHUB_ENV
- name: setup env to prod if tag is not empty
if: ${{ github.ref_type == 'tag' }}
run: |
echo "ENVIRONMENT=prod" >> $GITHUB_ENV
- name: setup env if input env is not empty
if: ${{ github.event.inputs.env }}
run: |
echo "ENVIRONMENT=${{ github.event.inputs.env }}" >> $GITHUB_ENV
- run: |
echo "::notice ::environment: ${{ env.ENVIRONMENT }}"
- name: get registry & region by env
run: |
case ${{ env.ENVIRONMENT }} in
dev)
echo "dev"
echo "BUCKET=flow360-help-center-dev" >> $GITHUB_ENV
echo "DIST_ID=EDDV9QC0FFXXM" >> $GITHUB_ENV
;;
prod)
echo "BUCKET=flow360-help-center-prod" >> $GITHUB_ENV
echo "DIST_ID=EQJGZRMR89VA7" >> $GITHUB_ENV
;;
esac
- name: Checkout without tag
if: ${{ !github.event.release.tag_name }}
uses: actions/checkout@master
- name: Checkout with tag
uses: actions/checkout@master
if: ${{ github.event.release.tag_name }}
with:
ref: ${{ github.event.release.tag_name }}
- name: setup-node
uses: actions/setup-node@v3
with:
node-version: 16
- name: install yarn
run:
npm install -g yarn
- name: prepare for vuepress
run:
python clear_myst_toctrees.py docs
- name: build
run: |
yarn install
yarn run docs:build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }}
aws-region: us-east-1
- uses: reggionick/s3-deploy@v3
with:
invalidation: '/*'
bucket: ${{ env.BUCKET }}
bucket-region: us-east-1
folder: docs/.vuepress/dist
dist-id: ${{ env.DIST_ID }}
delete-removed: true
private: true