Build DocC docs and Deploy to GitHub Pages #2
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: Build DocC docs and Deploy to GitHub Pages | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_call: | |
inputs: | |
package_name: | |
type: string | |
required: false | |
description: "The name of the package to build docs for." | |
modules: | |
type: string | |
required: true | |
description: "The modules in the package to build docs for." | |
workflow_dispatch: | |
inputs: | |
repository: | |
type: string | |
required: true | |
description: "The repository of the package to build docs for." | |
package_name: | |
type: string | |
required: true | |
description: "The name of the package to build docs for." | |
modules: | |
type: string | |
required: true | |
description: "The modules in the package to build docs for." | |
env: | |
INPUT_REPOSITORY: ${{ inputs.repository || github.repository }} | |
INPUT_PACKAGE_NAME: ${{ inputs.package_name }} | |
INPUT_MODULES: ${{ inputs.modules }} | |
jobs: | |
build-and-deploy-docs: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ inputs.repository || github.repository }} | |
fetch-depth: 0 | |
- name: Install latest Swift | |
uses: vapor/swiftly-action@v0.1 | |
with: | |
toolchain: latest | |
- name: Download files | |
run: | | |
curl -sL \ | |
"https://raw.githubusercontent.com/vapor/api-docs/main/generate-package-api-docs.swift" \ | |
-o generate-package-api-docs.swift \ | |
"https://raw.githubusercontent.com/vapor/api-docs/main/theme-settings.json" \ | |
-o theme-settings.json | |
- name: Build docs | |
run: 'swift generate-package-api-docs.swift "${INPUT_PACKAGE_NAME}" ${INPUT_MODULES}' | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
force_orphan: true |