Skip to content

Commit d250c5b

Browse files
committed
Split merging functionality into separate action called by deploy-pages
1 parent ecd5e44 commit d250c5b

File tree

2 files changed

+64
-26
lines changed

2 files changed

+64
-26
lines changed

deploy-pages/action.yml

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Deploy hexdoc book to Pages
2-
description: Deploys a hexdoc book to GitHub Pages.
2+
description: Merges a new version of a hexdoc book into an existing site, then deploys it to GitHub Pages.
33
author: hexdoc-dev
44

55
inputs:
@@ -27,36 +27,19 @@ inputs:
2727
runs:
2828
using: composite
2929
steps:
30-
- name: Download Pages artifact
31-
uses: actions/download-artifact@v4
30+
- uses: hexdoc-dev/actions/merge@v0
3231
with:
33-
name: ${{ inputs.pages-artifact }}
34-
35-
- name: Unzip web book
36-
shell: bash
37-
run: |
38-
mkdir -p _site/src
39-
unzip site.zip -d _site/src/docs
40-
41-
- name: Checkout current Pages
42-
uses: actions/checkout@v4
43-
continue-on-error: true
44-
with:
45-
ref: ${{ inputs.pages-branch }}
46-
path: _site/dst
47-
48-
- name: Merge web book
49-
env:
50-
HEXDOC_PROPS: ${{ inputs.props }}
51-
HEXDOC_RELEASE: ${{ inputs.release }}
52-
HEXDOC_SUBDIRECTORY: ${{ inputs.subdirectory }}
53-
GITHUB_PAGES_URL: ${{ inputs.site-url }}
54-
shell: bash
55-
run: hexdoc ci merge
32+
release: ${{ inputs.release }}
33+
props: ${{ inputs.props }}
34+
subdirectory: ${{ inputs.subdirectory }}
35+
site-url: ${{ inputs.site-url }}
36+
pages-artifact: ${{ inputs.pages-artifact }}
37+
pages-branch: ${{ inputs.pages-branch }}
5638

5739
- name: Deploy to Pages
5840
uses: JamesIves/github-pages-deploy-action@v4
5941
with:
42+
branch: ${{ inputs.pages-branch }}
6043
folder: _site/dst/docs/${{ inputs.subdirectory }}
6144
target-folder: docs/${{ inputs.subdirectory }}
6245
clean: true

merge/action.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Merge hexdoc book
2+
description: Merges a new version of a hexdoc book into an existing site.
3+
author: hexdoc-dev
4+
5+
inputs:
6+
release:
7+
description: "Boolean: if the book should be written to the release path (true) or the latest path (false)"
8+
required: true
9+
props:
10+
description: Path to your props file (hexdoc.toml or properties.toml)
11+
required: false
12+
subdirectory:
13+
description: Subdirectory to deploy the book to
14+
required: false
15+
site-url:
16+
description: Set the base site url instead of looking up the current repo's GitHub Pages url
17+
required: false
18+
pages-artifact:
19+
description: Name of the GitHub Pages artifact to download
20+
required: false
21+
default: hexdoc-pages
22+
pages-branch:
23+
description: Name of the branch used for GitHub Pages
24+
required: false
25+
default: gh-pages
26+
27+
runs:
28+
using: composite
29+
steps:
30+
- name: Download Pages artifact
31+
uses: actions/download-artifact@v4
32+
with:
33+
name: ${{ inputs.pages-artifact }}
34+
35+
- name: Unzip web book
36+
shell: bash
37+
run: |
38+
mkdir -p _site/src
39+
unzip site.zip -d _site/src/docs
40+
41+
- name: Checkout current Pages
42+
uses: actions/checkout@v4
43+
continue-on-error: true
44+
with:
45+
ref: ${{ inputs.pages-branch }}
46+
path: _site/dst
47+
48+
- name: Merge web book
49+
env:
50+
HEXDOC_PROPS: ${{ inputs.props }}
51+
HEXDOC_RELEASE: ${{ inputs.release }}
52+
HEXDOC_SUBDIRECTORY: ${{ inputs.subdirectory }}
53+
GITHUB_PAGES_URL: ${{ inputs.site-url }}
54+
shell: bash
55+
run: hexdoc ci merge

0 commit comments

Comments
 (0)