Skip to content

README (#138)

README (#138) #50

Workflow file for this run

# Generates and Deploys DocC documentation to Github pages
# See: https://maxxfrazer.medium.com/deploying-docc-with-github-actions-218c5ca6cad5
name: DocC
on:
push:
branches: [ "main" ]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Single deploy job since we're just deploying
docc:
environment:
# Must be set to this for deploying to GitHub Pages
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
runs-on: macos-26
steps:
- uses: actions/checkout@v4
- name: Add Plugin Dependency
run: swift package add-dependency "https://github.com/apple/swift-docc-plugin" --branch main
- name: Generate Documentation
run: |
swift package \
--allow-writing-to-package-directory \
--allow-writing-to-directory ${{github.workspace}}/docs \
generate-documentation \
--target OAuthKit \
--transform-for-static-hosting \
--hosting-base-path OAuthKit \
--output-path ${{github.workspace}}/docs \
--source-service github \
--source-service-base-url https://github.com/codefiesta/OAuthKit/blob/main \
--checkout-path ${{github.workspace}};
- name: Update Index
run: echo "<script>window.location.href += \"/documentation/oauthkit\"</script>" > ${{github.workspace}}/docs/index.html;
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4