From ea92dab1c38844ac2c0251d0229a432e897849b0 Mon Sep 17 00:00:00 2001 From: Manuel Polo Date: Sun, 18 Oct 2026 12:10:37 +0000 Subject: [PATCH] ci: attach the generated Javadoc to each release as a tar.gz The Javadoc of a release is built with the same commands as the Pages job and attached to the GitHub release together with its SHA-256, so the QTSurfer website can publish it. The archive is built after every release, and by hand for a release that already exists. The Pages deployment is unchanged. --- .github/workflows/ci.yml | 10 ++++++ .github/workflows/reference-docs.yml | 53 ++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .github/workflows/reference-docs.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dec385..658d37b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,16 @@ jobs: --title "$GITHUB_REF_NAME" \ --notes-file /tmp/release-notes.md + # Attaches the generated documentation to the release, for the QTSurfer website to publish. + reference-docs: + needs: release + if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + uses: ./.github/workflows/reference-docs.yml + with: + tag: ${{ github.ref_name }} + docs: needs: build runs-on: ubuntu-latest diff --git a/.github/workflows/reference-docs.yml b/.github/workflows/reference-docs.yml new file mode 100644 index 0000000..90dd18a --- /dev/null +++ b/.github/workflows/reference-docs.yml @@ -0,0 +1,53 @@ +name: Reference documentation archive + +# Attaches the generated Javadoc of a release to that release, as a tar.gz with its checksum, so the +# QTSurfer website can publish it. It runs after every release (see ci.yml) and by hand to build the +# archive of a release that already exists. +on: + workflow_call: + inputs: + tag: + description: Release tag to document + required: true + type: string + workflow_dispatch: + inputs: + tag: + description: Existing release tag to document + required: true + type: string + +permissions: + contents: write + +jobs: + archive: + runs-on: ubuntu-latest + env: + TAG: ${{ inputs.tag }} + GH_TOKEN: ${{ github.token }} + steps: + - name: Check that the release exists + run: gh release view "$TAG" --repo "$GITHUB_REPOSITORY" > /dev/null + - uses: actions/checkout@v4 + with: + ref: refs/tags/${{ inputs.tag }} + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + # These sources are generated from the spec, so they have to exist before + # javadoc can read them. + - name: Generate javadoc + run: mvn -B generate-sources javadoc:javadoc + - name: Package the documentation + run: | + name="api-client-java-docs-${TAG}" + tar -czf "${name}.tar.gz" -C target/site/apidocs . + sha256sum "${name}.tar.gz" > "${name}.tar.gz.sha256" + - name: Attach it to the release + run: | + name="api-client-java-docs-${TAG}" + gh release upload "$TAG" "${name}.tar.gz" "${name}.tar.gz.sha256" \ + --repo "$GITHUB_REPOSITORY" --clobber