From 025f9328219d30338e7b8302d9044a91d3ac2482 Mon Sep 17 00:00:00 2001 From: Rachel Brindle Date: Sat, 30 Mar 2024 14:47:12 -0700 Subject: [PATCH] Build docs as part of github --- .github/workflows/documentation.yml | 30 +++++++++++++++++++++++++++ script/{build_docs.zsh => build_docs} | 9 +++----- script/release | 6 +----- 3 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/documentation.yml rename script/{build_docs.zsh => build_docs} (74%) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 000000000..af8eaf1fc --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,30 @@ +name: Build Documentation +on: + push: + branches: + - main + tags: + - "*" + pull_request: + branches: + - "*" + +permissions: + contents: write + +jobs: + build-documentation: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build Docs + run: | + ./script/build_docs + + - name: Deploy Docs + if: github.ref == 'refs/heads/main' + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: docs diff --git a/script/build_docs.zsh b/script/build_docs similarity index 74% rename from script/build_docs.zsh rename to script/build_docs index cac9eddff..88aa81a6f 100755 --- a/script/build_docs.zsh +++ b/script/build_docs @@ -1,15 +1,12 @@ -#!/bin/zsh - -GIT_ROOT=$(git rev-parse --show-toplevel) -pushd "${GIT_ROOT}" 2>&1 >/dev/null +#!/usr/bin/env sh export DOCC_JSON_PRETTYPRINT="YES" +mkdir -p docs + swift package --allow-writing-to-directory docs \ generate-documentation --target Nimble \ --disable-indexing \ --transform-for-static-hosting \ --hosting-base-path 'https://quick.github.io/Nimble' \ --output-path docs - -popd diff --git a/script/release b/script/release index 742dbcfdb..ba0d03394 100755 --- a/script/release +++ b/script/release @@ -127,11 +127,7 @@ else git add ${PODSPEC} || { restore_podspec; die "Failed to add ${PODSPEC} to INDEX"; } - echo "--- Updating Docs ---" - ./script/build_docs.zsh - git add docs || { git co docs; die "Failed to add docs to INDEX"; } - - git commit -m "[$VERSION_TAG] Update docs and podspec" || { restore_podspec; die "Failed to push updated version: $VERSION"; } + git commit -m "[$VERSION_TAG] Update podspec" || { restore_podspec; die "Failed to push updated version: $VERSION"; } fi RELEASE_NOTES="Version ${VERSION}. Open https://github.com/Quick/Nimble/releases/tag/$VERSION_TAG for full release notes."