diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4d9f9c..8a67cee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,7 @@ name: Build & publish docs (rc + release) on: push: tags: + - "draft*" - "rc*" - "v*" workflow_dispatch: @@ -100,7 +101,7 @@ jobs: zip -r "${GITHUB_REF_NAME}.zip" ./${GITHUB_REF_NAME} - name: Publish prerelease - if: startsWith(github.ref_name, 'rc') + if: startsWith(github.ref_name, 'rc') || startsWith(github.ref_name, 'draft') uses: softprops/action-gh-release@v2 with: prerelease: true @@ -152,4 +153,19 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git commit -m "Deploy RC preview ${GITHUB_REF_NAME}" || echo "No changes to commit" + git push origin gh-pages + + - name: Deploy draft preview to /draft/ + if: startsWith(github.ref_name, 'draft') + run: | + set -euo pipefail + rm -rf draft + mkdir -p draft + cp -a ${RUNNER_TEMP}/mkdocs_out/site/. draft/ + printf '{"tag":"%s"}\n' "${GITHUB_REF_NAME}" > draft/draft.json + + git add -A + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git commit -m "Deploy draft preview ${GITHUB_REF_NAME}" || echo "No changes to commit" git push origin gh-pages \ No newline at end of file