diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68a2d16..95de026 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,7 +155,7 @@ jobs: delete-untagged: true validate: true - ci-pages: + ci-pages-build: runs-on: ubuntu-latest container: image: ghcr.io/fixposition/fixposition-sdk:trixie-ci @@ -166,8 +166,9 @@ jobs: - ci-fpsdk-jazzy - ci-fpsdk-lyrical permissions: - pages: write - id-token: write + contents: read + outputs: + artifact_name: ${{ steps.pages-artifact-name.outputs.name }} steps: - name: Checkout uses: actions/checkout@v6 @@ -178,6 +179,7 @@ jobs: uses: actions/download-artifact@v8 with: path: build-artefacts # See Doxyfile and Makefile + pattern: fpsdk_common_versions_* # We'll get: # build-artefacts/fpsdk_common_versions_trixie/fpsdk_common/fpsdk_common_versions.txt # build-artefacts/fpsdk_common_versions_jazzy/fpsdk_common/fpsdk_common_versions.txt @@ -201,22 +203,38 @@ jobs: ##### Archive generated HTML as artefacts + # Unique name per attempt, as re-running the job would otherwise produce a second artefact with the + # same name, which makes actions/deploy-pages fail ("Multiple artifacts named "github-pages"...") + - name: Pages artefact name + id: pages-artifact-name + run: echo "name=github-pages-${{ github.run_attempt }}" >> ${GITHUB_OUTPUT} + # for pages deployment. Both actions make the artefact show up as a job artefact. - name: Upload pages artefact uses: actions/upload-pages-artifact@v5 # https://github.com/actions/upload-pages-artifact (This, not actions/upload-artifact, which doesn't work) with: path: github-pages + name: ${{ steps.pages-artifact-name.outputs.name }} - ##### Deploy to fixposition.github.io/fixposition-sdk (only on main branch) + ##### Deploy to fixposition.github.io/fixposition-sdk (only on main branch) + # Separate job, as actions/deploy-pages in the same job as actions/upload-pages-artifact sometimes doesn't find the + # artefact ("No artifacts named "github-pages" were found"), see https://github.com/actions/deploy-pages/issues/451 + ci-pages-deploy: + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/pull/232/merge' }} + runs-on: ubuntu-latest + needs: + - ci-pages-build + permissions: + pages: write + id-token: write + steps: - name: Configure pages - if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/pull/193/merge' }} uses: actions/configure-pages@v6 # https://github.com/actions/configure-pages - name: Deploy pages - if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/pull/193/merge' }} uses: actions/deploy-pages@v5 with: - artifact_name: github-pages # https://github.com/actions/deploy-pages + artifact_name: ${{ needs.ci-pages-build.outputs.artifact_name }} # https://github.com/actions/deploy-pages # eof