forked from bcgov/NotifyBC
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (42 loc) · 1.69 KB
/
ghPages.yml
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
name: Publish to GH Pages
on:
push:
branches:
- v4
- v5
release:
types:
- published
env:
notifyBCDocVersion_PATH: /
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Update notifyBCDocVersion_PATH for releases
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: echo notifyBCDocVersion_PATH=/version/$(echo $GITHUB_REF | cut -d / -f 3 | cut -d v -f 2- | cut -d . -f 1,2)/ >> $GITHUB_ENV
- name: Update notifyBCDocVersion_PATH for non-main branches
if: ${{ github.ref_type == 'branch' && github.ref_name != 'main'}}
run: echo notifyBCDocVersion_PATH=/preview/ >> $GITHUB_ENV
- name: Checkout 🛎️
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ vars.NODE_VERSION }}
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
cd docs
npm ci
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: docs/.vuepress/dist # The folder the action should deploy.
TARGET_FOLDER: ${{ env.notifyBCDocVersion_PATH }}
CLEAN: true # Automatically remove deleted files from the deploy branch
CLEAN_EXCLUDE: '["version"]'