-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
61 lines (61 loc) · 2.57 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
57
58
59
60
61
name: "Remarkable Pages"
description: "Automatically serve your Remark presentation with GitHub Pages"
branding:
icon: 'star'
color: 'yellow'
inputs:
pages-branch:
description: "Branch you're serving pages from"
default: "pages"
required: false
markdown-path: # id of input
description: "Optional relative path to your presentation markdown file. Defaults to presentation.md in your repo"
default: "presentation.md"
required: false
static-html-path:
description: "Optional relative path to a custom HTML file to serve the presentation. Defaults to the default HTML example from Remark"
default: "DEFAULT_HTML_PATH"
required: false
repo-token:
description: Access token that can pull and push to the given repository
default: ${{ github.token }}
runs:
using: "composite"
steps:
- id: create-base-directories
run: "mkdir /tmp/clone && cd /tmp/clone && echo ${{inputs.repo-token}}"
shell: bash
# Perhaps there is a better way to do this rather than cloning twice
# But this is pretty straightforward so will keep for now.
- id: clone-base-repo
run: "git clone https://x-access-token:${{inputs.repo-token}}@github.com/${{github.repository}}.git base"
shell: bash
- id: clone-base-repo-for-pages
run: |
echo "Cloning pages copy"
git clone --single-branch --branch ${{inputs.pages-branch}} https://x-access-token:${{inputs.repo-token}}@github.com/${{github.repository}}.git pages || { git clone https://x-access-token:${{inputs.repo-token}}@github.com/${{github.repository}}.git pages && git -C ./pages checkout -b ${{inputs.pages-branch}} && git -C ./pages push --set-upstream origin ${{inputs.pages-branch}}; }
shell: bash
- id: copy-markdown
run: |
echo "Copying Markdown"
cp base/${{inputs.markdown-path}} ./pages/presentation.md
shell: bash
- id: copy-html
run: |
echo "Copying HTML"
if [ "${{inputs.static-html-path}}" == "DEFAULT_HTML_PATH" ]; then
cp ${{ github.action_path }}/boilerplate.html ./pages/index.html
else
cd base
cp ${{inputs.static-html-path}} ../pages/index.html
fi
shell: bash
- id: commit-and-push
run: |
echo "Committing"
git -C ./pages config user.name github-actions
git -C ./pages config user.email github-actions@github.com
git -C ./pages add ./index.html presentation.md
git -C ./pages commit -m 'Auto commit from Remarkable GitHub Action build' || exit 0
git -C ./pages push || exit 0
shell: bash