Use a citron that works with XCode #21
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: Extract And Publish Documentation | |
defaults: | |
run: | |
shell: 'bash -eo pipefail {0}' | |
on: | |
push: | |
branches: ["main", "docc"] | |
# 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: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
if: github.repository == 'hylo-lang/Lotsawa' | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
show-progress: false | |
- name: Make site Directory | |
run: mkdir -p _site/docc | |
- name: Install Jazzy | |
run: | | |
gem install jazzy | |
- name: Setup swift | |
uses: swift-actions/setup-swift@v1 | |
with: | |
swift-version: 5.9 | |
- name: Prepare Shell Environment | |
# The format of the ${GITHUB_ENV} file is extremely restrictive; it apparently only supports | |
# lines of the form: | |
# | |
# <variable-name>=<one-line-of-text> | |
# | |
# And a multiline version | |
# (https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings). | |
# It is not interpreted directly by a shell, so any quotes or other special characters are | |
# taken literally. | |
# FIXME: REF_URL_COMPONENT computation is probably wrong for some refs. | |
run: | | |
echo "REPO_SANS_OWNER=${GITHUB_REPOSITORY##*/} | |
REF_URL_COMPONENT=${GITHUB_REF##*/} | |
LOTSAWA_ENABLE_DOC_GENERATION=1 | |
" >> "${GITHUB_ENV}" | |
- name: Extract with DocC | |
run: | | |
mkdir -p _site/docc | |
swift package --allow-writing-to-directory ./_site \ | |
generate-documentation \ | |
--product Lotsawa \ | |
--output-path _site/docc \ | |
--experimental-documentation-coverage --level detailed \ | |
--enable-inherited-docs \ | |
--transform-for-static-hosting \ | |
--hosting-base-path "${REPO_SANS_OWNER}/docc/${TARGET}" \ | |
--source-service github \ | |
--source-service-base-url "https://github.com/${GITHUB_REPOSITORY}/blob/${REF_URL_COMPONENT}" \ | |
--checkout-path "$(pwd)" | |
- name: Extract with Jazzy | |
run: | | |
mkdir -p _site/jazzy | |
jazzy \ | |
--source-host-files-url "https://github.com/${GITHUB_REPOSITORY}/blob/${REF_URL_COMPONENT}" \ | |
--module Lotsawa \ | |
--module-version "${{ github.event.release.tag_name }}" \ | |
--copyright "© $(date '+%Y') Dave Abrahams. (Last updated: $(date '+%Y-%m-%d'))" \ | |
--config .jazzy.yml \ | |
--output _site/jazzy \ | |
--min-acl private | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Fix permissions | |
run: | | |
chmod -v -R +rX "_site/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
# Deployment job | |
deploy: | |
if: github.repository == 'hylo-lang/Lotsawa' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |