-
Notifications
You must be signed in to change notification settings - Fork 78
75 lines (66 loc) · 2.38 KB
/
publish-to-gh-pages.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
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
name: Build and Deploy
on:
workflow_dispatch:
push:
branches:
- master
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
# Load environment variables from repository settings,
# environment should be named "production"
# https://github.com/cadence-workflow/Cadence-Docs/settings/environments
environment: production
env:
CADENCE_DOCS_URL: ${{ vars.CADENCE_DOCS_URL }}
BASE_URL: ${{ vars.BASE_URL }}
ORGANIZATION_NAME: ${{ vars.ORGANIZATION_NAME }}
steps:
- name: Set environment variables
env:
REPO_NAME: ${{ github.repository }}
id: split
run: |
if [[ -z "${PROJECT_NAME}" ]]; then
echo "PROJECT_NAME not provided, using last part of repository name"
echo "PROJECT_NAME=${REPO_NAME##*/}" >> $GITHUB_ENV
fi
if [[ -z "${BASE_URL}" ]]; then
echo "BASE_URL not provided, using repo name for gh-pages"
echo "BASE_URL=/${REPO_NAME##*/}/" >> $GITHUB_ENV
fi
if [[ -z "${ORGANIZATION_NAME}" ]]; then
echo "ORGANIZATION_NAME not provided, using the first part of the repository name"
echo "ORGANIZATION_NAME=${REPO_NAME/\/*/}" >> $GITHUB_ENV
fi
# same as build.yml
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
# configure custom domain for github pages
# files placed under static folder will be copied to the root of the build folder
- name: Configure domain
uses: finnp/[email protected]
env:
FILE_NAME: "static/CNAME"
FILE_DATA: ${{ secrets.CUSTOM_DOMAIN }}
- name: Use Node.js lts/hydrogen (v18)
uses: actions/setup-node@v4
with:
node-version: lts/hydrogen
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
cache: "npm"
- name: Install and Build 🔧
run: |
npm install
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: build # The folder the action should deploy.
clean: true # Automatically remove deleted files from the deploy branch