-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
56 lines (52 loc) · 1.77 KB
/
action.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
name: 'websmith.js'
description: 'Deploy HTML websites generated using websmith.js'
inputs:
repository:
description: 'Repository name with owner, e.g. mbruno46/websmith.js'
default: ${{ github.repository }}
ref:
description: >
The branch, tag or SHA to checkout. When checking out the repository that
triggered a workflow, this defaults to the reference or SHA for that
event. Otherwise, uses the default branch.
config:
description: 'Relative path in the repository with the config.json file'
required: true
build:
description: 'Relative path in the repository of the build directory'
required: true
doc-branch:
description: 'Target branch for documentation deployment'
required: true
default: 'gh-pages'
runs:
using: "composite"
steps:
- name: 'Set env vars'
run: |
echo "REMOTE=https://${{ github.actor }}:${{ github.token }}@github.com/${{ inputs.repository }}.git" >> $GITHUB_ENV
shell: bash
- name: 'Checkout websmith.js and install dependencies'
run: |
git clone https://github.com/mbruno46/websmith.js.git
cd websmith.js
npm install
npm list
shell: bash
- name: 'Build website'
run: |
node websmith.js/main.js ${{ inputs.config }}
shell: bash
- name: 'Publish'
run: |
cd ${{ inputs.build }}
touch .nojekyll
git init
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git add .
git commit -m '[websmith.js] publishing website'
git remote add origin ${REMOTE}
git config --global --list
git push --force origin master:${{ inputs.doc-branch }}
shell: bash