Skip to content

Add GitHub Actions workflow to update GitHub Pages - #1671

Open
snprajwal wants to merge 1 commit into
swiftlang:mainfrom
snprajwal:gha-pages
Open

snprajwal wants to merge 1 commit into
swiftlang:mainfrom
snprajwal:gha-pages

Conversation

@snprajwal

Copy link
Copy Markdown
Contributor

The API docs for this project is hosted at
https://swiftlang.github.io/swift-docc/documentation/swift-docc. These docs had to be manually updated by running
bin/update-gh-pages-documentation-site frequently. Introduce a GitHub Actions workflow that automatically updates the docs upon merge. The identity of the merge author is used to create the commit with the updated docs.

@snprajwal
snprajwal requested a review from a team as a code owner September 18, 2026 17:44
The API docs for this project is hosted at
https://swiftlang.github.io/swift-docc/documentation/swift-docc. These
docs had to be manually updated by running
bin/update-gh-pages-documentation-site frequently. Introduce a GitHub
Actions workflow that automatically updates the docs upon merge. The
identity of the merge author is used to create the commit with the
updated docs.
@heckj

heckj commented Sep 29, 2026

Copy link
Copy Markdown
Member

Do you want to keep pushing these to GitHub Pages to verify the process? Because they're included in the combined docs now for swift.org - github.com/swiftlang/docs which builds out docs.swift.org/main/documentation (and docs.swift.org/latest/documentation)

@d-ronnqvist

Copy link
Copy Markdown
Contributor

Do you want to keep pushing these to GitHub Pages to verify the process? Because they're included in the combined docs now for swift.org - github.com/swiftlang/docs which builds out docs.swift.org/main/documentation (and docs.swift.org/latest/documentation)

We push library / contributor documentation to GitHub Pages and more high-level user-facing documentation about the DocC tool and syntax to swift.org.

@d-ronnqvist

Copy link
Copy Markdown
Contributor

If we'll push to GitHub pages automatically, do we still need bin/update-gh-pages-documentation-site or can we remove that script?

--checkout-path "$GITHUB_WORKSPACE" \
--experimental-transform-for-static-hosting-with-content \
--hosting-base-path swift-docc \
--output-path "$GITHUB_WORKSPACE/_site/docs"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm mostly just curious where the _site component comes from. AFAICT we don't specify it in bin/update-gh-pages-documentation-site and I'm not sure how that script compares to running a GH "action".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script uses a separate worktree, whereas the action builds into the existing worktree in an untracked directory, and then copies that over to replace the docs directory on the gh-pages branch. I semi-arbitrarily picked _site as a prefix so we don't get confused with the source and target directories when reading the logs, but it can be anything we want.

I've seen other web frontend projects, e.g. Webpack place the build output in dist/, so we can also do that if it's clearer.

@snprajwal

Copy link
Copy Markdown
Contributor Author

If we'll push to GitHub pages automatically, do we still need bin/update-gh-pages-documentation-site or can we remove that script?

We can remove it, I've configured the action to allow manually triggering it, so if we need to rebuild for whatever reason, we're able to do that via GHA itself. I'd prefer to keep it around for at least a few runs of this action, just to make sure everything works fine, and then delete it in a separate PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants