-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Deploy to GitHub Pages | ||
on: | ||
workflow_call: | ||
inputs: | ||
settings: | ||
required: true | ||
description: "The path to your Pelican settings file (`pelican`'s `--settings` option), for example: 'publishconf.py'" | ||
type: string | ||
requirements: | ||
required: false | ||
default: "pelican" | ||
description: "The Python requirements to install, for example to enable markdown and typogrify use: 'pelican[markdown] typogrify' or if you have a requirements file use: '-r requirements.txt'" | ||
type: string | ||
output-path: | ||
required: false | ||
default: "output/" | ||
description: "Where to output the generated files (`pelican`'s `--output` option)" | ||
type: string | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Configure GitHub Pages | ||
id: pages | ||
uses: actions/configure-pages@v3 | ||
- name: Install requirements | ||
run: pip install ${{ inputs.requirements }} | ||
- name: Build Pelican site | ||
run: | | ||
pelican \ | ||
--settings "${{ inputs.settings }}" \ | ||
--extra-settings SITEURL='"${{ steps.pages.outputs.base_url }}"' \ | ||
--output "${{ inputs.output-path }}" | ||
- name: Fix permissions | ||
run: | | ||
chmod -c -R +rX "${{ inputs.output-path }}" | while read line; do | ||
echo "::warning title=Invalid file permissions automatically fixed::$line" | ||
done | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: ${{ inputs.output-path }} | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters