Skip to content

Commit 4183f25

Browse files
committed
Add reusable action using build and deploy-pages
1 parent f53b4f1 commit 4183f25

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.github/workflows/hexdoc.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: "[Reusable] Build and publish a hexdoc plugin with a web book"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
description: Python version to install
8+
type: string
9+
required: true
10+
release:
11+
description: If the book should be written to the release path or the latest path
12+
type: boolean
13+
required: true
14+
props:
15+
description: Path to your props file (hexdoc.toml or properties.toml)
16+
type: string
17+
required: false
18+
pip-extras:
19+
description: Pip extras for your package (eg. [dev])
20+
type: string
21+
required: false
22+
deploy-pages:
23+
description: If the workflow should deploy to GitHub Pages
24+
type: boolean
25+
default: true
26+
subdirectory:
27+
description: Subdirectory to deploy the book to
28+
type: string
29+
required: false
30+
site-url:
31+
description: Set the base site url instead of looking up the current repo's GitHub Pages url
32+
type: string
33+
required: false
34+
use-artifacts-v3:
35+
description: If true, use actions/upload-artifact@v3 instead of actions/upload-artifact@v4
36+
type: boolean
37+
default: true
38+
secrets:
39+
GH_TOKEN:
40+
required: true
41+
outputs:
42+
pages-url:
43+
description: Current GitHub Pages url for this repo
44+
value: ${{ jobs.build.outputs.pages-url }}
45+
release:
46+
description: Value of inputs.release for convenience
47+
value: ${{ inputs.release }}
48+
49+
permissions:
50+
contents: read
51+
52+
jobs:
53+
build:
54+
runs-on: ubuntu-latest
55+
permissions:
56+
contents: read
57+
pages: read
58+
outputs:
59+
pages-url: ${{ steps.build.outputs.pages-url }}
60+
steps:
61+
- uses: actions/checkout@v4
62+
- id: build
63+
uses: hexdoc-dev/actions/build@v0
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
66+
with:
67+
python-version: ${{ inputs.python-version }}
68+
release: ${{ inputs.release }}
69+
props: ${{ inputs.props }}
70+
pip-extras: ${{ inputs.pip-extras }}
71+
subdirectory: ${{ inputs.subdirectory }}
72+
use-artifacts-v3: ${{ inputs.use-artifacts-v3 }}
73+
site-url: ${{ inputs.site-url }}
74+
75+
deploy-pages:
76+
needs: build
77+
if: inputs.deploy-pages
78+
runs-on: ubuntu-latest
79+
concurrency:
80+
group: hexdoc-deploy-pages
81+
cancel-in-progress: false
82+
permissions:
83+
contents: write
84+
steps:
85+
- uses: actions/checkout@v4
86+
- uses: hexdoc-dev/actions/deploy-pages@v0
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
89+
with:
90+
python-version: ${{ inputs.python-version }}
91+
release: ${{ inputs.release }}
92+
props: ${{ inputs.props }}
93+
pip-extras: ${{ inputs.pip-extras }}
94+
subdirectory: ${{ inputs.subdirectory }}
95+
use-artifacts-v3: ${{ inputs.use-artifacts-v3 }}
96+
site-url: ${{ needs.build.outputs.pages-url }}

0 commit comments

Comments
 (0)