Update documentation workflow (#79)
* Remove documentation workflow * Update docc plugin dependency * Add documentation workflow * Update hosting basepath * Update JamesIves/github-pages-deploy-action@v4.6.8
This commit is contained in:
parent
fdf08687d6
commit
759f562316
|
|
@ -1,32 +1,75 @@
|
||||||
|
# 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
|
name: Documentation
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches:
|
||||||
paths:
|
- master
|
||||||
- .github/workflows/documentation.yml
|
|
||||||
- Sources/FirebladeECS/**.swift
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
branches: [ master ]
|
|
||||||
paths:
|
concurrency:
|
||||||
- .github/workflows/documentation.yml
|
group: docs-${{ github.ref }}
|
||||||
- Sources/FirebladeECS/**.swift
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: macos-14
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- name: Select Xcode 16.0
|
||||||
- name: Generate Swift Doc Documentation
|
run: sudo xcode-select -s /Applications/Xcode_16.0.app
|
||||||
uses: SwiftDocOrg/swift-doc@1.0.0-rc.1
|
|
||||||
|
- name: Checkout Package
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
inputs: "Sources/FirebladeECS"
|
fetch-depth: 0
|
||||||
output: "Documentation"
|
|
||||||
- name: Publish to wiki
|
- name: Checkout gh-pages Branch
|
||||||
uses: SwiftDocOrg/github-wiki-publish-action@master
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: "Documentation"
|
ref: gh-pages
|
||||||
env:
|
path: docs
|
||||||
GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
|
||||||
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
- name: Build documentation
|
||||||
|
run: >
|
||||||
|
rm -rf docs/.git;
|
||||||
|
rm -rf docs/master;
|
||||||
|
git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | tail -n +6 | xargs -I {} rm -rf {};
|
||||||
|
|
||||||
|
for tag in $(echo "master"; git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | head -6);
|
||||||
|
do
|
||||||
|
if [ -d "docs/$tag/data/documentation/fireblade-ecs" ]
|
||||||
|
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 \
|
||||||
|
--target FirebladeECS \
|
||||||
|
--output-path docs/"$tag" \
|
||||||
|
--transform-for-static-hosting \
|
||||||
|
--hosting-base-path /FirebladeECS/"$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
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "swift-docc-plugin",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-docc-plugin",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "85e4bb4e1cd62cec64a4b8e769dcefdf0c5b9d64",
|
||||||
|
"version" : "1.4.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-docc-symbolkit",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/swiftlang/swift-docc-symbolkit",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
|
||||||
|
"version" : "1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version" : 2
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,7 @@ let package = Package(
|
||||||
targets: ["FirebladeECS"])
|
targets: ["FirebladeECS"])
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
|
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.4.3")
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(name: "FirebladeECS",
|
.target(name: "FirebladeECS",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue