80 lines
2.6 KiB
YAML
80 lines
2.6 KiB
YAML
# Build and deploy DocC to GitHub pages. Based off of pointfreeco/swift-composable-architecture:
|
|
# https://github.com/pointfreeco/swift-composable-architecture/blob/main/.github/workflows/documentation.yml
|
|
name: Documentation
|
|
|
|
on:
|
|
release:
|
|
types:
|
|
- published
|
|
push:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: docs-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: macos-14
|
|
steps:
|
|
- name: Select Xcode 16.0
|
|
run: sudo xcode-select -s /Applications/Xcode_16.0.app
|
|
|
|
- name: Checkout Package
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Checkout gh-pages Branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: gh-pages
|
|
path: docs
|
|
|
|
- name: Build documentation
|
|
run: >
|
|
rm -rf docs/.git;
|
|
rm -rf docs/master;
|
|
git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.*" | tail -n +6 | xargs -I {} rm -rf {}; // remove all tag folders except the newest 6
|
|
|
|
// iterate the newest 6 tags and master
|
|
for tag in $(echo "master"; git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.*" | head -6);
|
|
do
|
|
if [ -d "docs/$tag/data/documentation/firebladeecs" ]
|
|
then
|
|
echo "✅ Documentation for "$tag" already exists.";
|
|
else
|
|
echo "⏳ Generating documentation for FirebladeECS @ "$tag" release.";
|
|
rm -rf "docs/$tag";
|
|
|
|
git checkout .;
|
|
git checkout "$tag";
|
|
|
|
DOCC_JSON_PRETTYPRINT=YES \
|
|
swift package \
|
|
--allow-writing-to-directory docs/"$tag" \
|
|
generate-documentation \
|
|
--fallback-bundle-identifier com.github.fireblade-engine.FirebladeECS \
|
|
--target FirebladeECS \
|
|
--output-path docs/"$tag" \
|
|
--transform-for-static-hosting \
|
|
--hosting-base-path ecs/"$tag" \
|
|
--source-service github \
|
|
--source-service-base-url https://fireblade-engine.github.io/ecs/"$tag" \
|
|
&& echo "✅ Documentation generated for FirebladeECS @ "$tag" release." \
|
|
|| echo "⚠️ Documentation skipped for FirebladeECS @ "$tag".";
|
|
fi;
|
|
done
|
|
|
|
- name: Fix permissions
|
|
run: 'sudo chown -R $USER docs'
|
|
|
|
- name: Publish documentation to GitHub Pages
|
|
uses: JamesIves/github-pages-deploy-action@v4.6.8
|
|
with:
|
|
branch: gh-pages
|
|
folder: docs
|
|
single-commit: true
|