Skip to content

Commit

Permalink
Update documentation workflow (#79)
Browse files Browse the repository at this point in the history
* Remove documentation workflow

* Update docc plugin dependency

* Add documentation workflow

* Update hosting basepath

* Update JamesIves/[email protected]
  • Loading branch information
ctreffs authored Nov 1, 2024
1 parent fdf0868 commit 759f562
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 22 deletions.
85 changes: 64 additions & 21 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -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

on:
release:
types:
- published
push:
branches: [ master ]
paths:
- .github/workflows/documentation.yml
- Sources/FirebladeECS/**.swift
branches:
- master
workflow_dispatch:
branches: [ master ]
paths:
- .github/workflows/documentation.yml
- Sources/FirebladeECS/**.swift

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

runs-on: macos-14
steps:
- uses: actions/checkout@master
- name: Generate Swift Doc Documentation
uses: SwiftDocOrg/[email protected]
- name: Select Xcode 16.0
run: sudo xcode-select -s /Applications/Xcode_16.0.app

- name: Checkout Package
uses: actions/checkout@v4
with:
inputs: "Sources/FirebladeECS"
output: "Documentation"
- name: Publish to wiki
uses: SwiftDocOrg/github-wiki-publish-action@master
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\+.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/[email protected]
with:
path: "Documentation"
env:
GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
branch: gh-pages
folder: docs
single-commit: true
23 changes: 23 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let package = Package(
targets: ["FirebladeECS"])
],
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: [
.target(name: "FirebladeECS",
Expand Down

0 comments on commit 759f562

Please sign in to comment.