-
Notifications
You must be signed in to change notification settings - Fork 6
86 lines (84 loc) · 2.46 KB
/
fork-build.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
76
77
78
79
80
81
82
83
84
85
86
name: Build site from Fork
on:
workflow_call:
inputs:
version:
description: the version of MarkBind to use. e.g. 4.0.0
default: 'latest'
type: string
rootDirectory:
description: read source files from the specified directory
default: '.'
type: string
siteConfig:
description: the site config file to use
default: 'site.json'
type: string
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
with:
path: curr-repo
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Graphviz
run: sudo apt-get install graphviz
- name: Install Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Checkout markbind-cli@master
if: inputs.version == 'development'
uses: actions/checkout@v3
with:
repository: MarkBind/markbind
path: markbind-cli
- name: Install markbind-cli@master
if: inputs.version == 'development'
run: |
cd markbind-cli
npm run setup && npm run build:web
cd packages/cli
npm link
cd ../../..
- name: Install a released version of markbind-cli
if: inputs.version != 'development'
run: |
npm install -g markbind-cli@${{ inputs.version }}
- name: Build site
run: |
cd curr-repo
markbind build ${{ inputs.rootDirectory }} ./_site \
--baseUrl --site-config ${{ inputs.siteConfig }}
cd ..
echo "Site Built!"
- name: Check build status
run: |
if [ ! -d "./curr-repo/_site" ]; then
echo "Build Error"
exit 1
fi
- name: Save PR number and HEAD commit
if: ${{ success() && github.event_name == 'pull_request' }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NUMBER
echo ${{ github.event.pull_request.head.sha }} > ./pr/SHA
- name: Upload artifacts
if: ${{ success() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v3
with:
name: site-artifacts
retention-days: 1
if-no-files-found: error
path: |
./curr-repo/_site
./pr