Merge pull request #111 from duplocloud/fancy-actions-install #65
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
name: Publish Docs | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
push: | |
description: Push site to Github Pages? | |
required: false | |
default: false | |
type: boolean | |
tag: | |
description: Ref to build docs from? | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
push: | |
description: Push site to Github Pages? | |
required: false | |
default: true | |
type: boolean | |
tag: | |
description: Ref to build docs from? | |
required: true | |
type: string | |
secrets: | |
GH_APP_KEY: | |
description: GitHub App private key | |
required: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | |
id: setup | |
uses: duplocloud/duploctl/.github/actions/setup@main | |
with: | |
ref: ${{ inputs.tag }} | |
fetch-depth: 0 | |
install: ".[build,docs]" | |
app-id: ${{ vars.GH_APP_ID }} | |
private-key: ${{ secrets.GH_APP_KEY }} | |
submodules: "true" | |
- name: Generated Docs Folder | |
run: | | |
mkdir -p dist dist/docs | |
- name: Build Docs | |
run: mkdocs build | |
- name: Fix permissions | |
run: | | |
chmod -c -R +rX "dist/site/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: dist/site | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: build | |
if: inputs.push || github.ref == 'refs/heads/main' | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |