Deploy Documentation to GitHub Pages #6
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: Deploy Documentation to GitHub Pages | |
on: | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Swift | |
uses: swift-actions/setup-swift@v2 | |
- name: Build Documentation | |
run: | | |
swift package --allow-writing-to-directory ./docs \ | |
generate-documentation --target FreemiumKit \ | |
--disable-indexing \ | |
--transform-for-static-hosting \ | |
--output-path ./docs | |
- name: Create index.html for redirection | |
run: | | |
echo '<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Redirecting...</title> | |
<meta http-equiv="refresh" content="0; url=/documentation/index/"> | |
<script type="text/javascript"> | |
window.location.href = "/documentation/index/"; | |
</script> | |
</head> | |
<body> | |
<p>If you are not redirected automatically, follow this <a href="/documentation/index/">Link</a>.</p> | |
</body> | |
</html>' > ./docs/index.html | |
- name: Deploy to Pages | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: docs |