From 016b1b7aefe9e26942fc160ef92a43a1fa3692fc Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 18 Dec 2025 18:39:28 +0000 Subject: [PATCH] Auto-create draft releases when building release tags Update the CI so that it drafts a release, with the correct artifacts attached and the release notes prepared, when building a rlease tag. --- .github/workflows/main.yml | 39 +++++++++++++++++++ .../internal/newsfragments/2275.clarification | 1 + 2 files changed, 40 insertions(+) create mode 100644 changelogs/internal/newsfragments/2275.clarification diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3bcc6010..126cd3c1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -243,6 +243,8 @@ jobs: name: "🔎 Validate generated HTML" runs-on: ubuntu-latest needs: [calculate-baseurl, build-spec] + # run even if generate-changelog was skipped + if: ${{ !failure() && !cancelled() }} steps: - name: "📥 Source checkout" uses: actions/checkout@v4 @@ -305,8 +307,45 @@ jobs: - name: "📦 Tarball creation" run: tar -czf spec-historical.tar.gz spec + - name: "📤 Artifact upload" uses: actions/upload-artifact@v4 with: name: spec-historical-artifact path: spec-historical.tar.gz + + # If we're building a tag, create a release and publish the artifacts + create_release: + name: "Create release" + if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }} + needs: + - build-spec + - build-historical-spec + runs-on: ubuntu-latest + steps: + - name: "📥 Check out changelogs" + uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + with: + sparse-checkout: | + content/changelog + - name: "📥 Download built spec" + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + with: + name: spec-artifact + - name: "📥 Download historical spec artifact" + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + with: + name: spec-historical-artifact + - name: "✨ Create draft release" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Remove front-matter from changelog + sed '1,/^---$/d' "content/changelog/${{ github.ref_name }}.md" > changelog.md + + # Create a draft release, using the changelog as release notes, and attaching the spec artifacts. + gh release create -d -t "${{ github.ref_name }}" \ + -F "changelog.md" \ + "${{ github.ref_name }}" \ + spec.tar.gz \ + spec-historical.tar.gz diff --git a/changelogs/internal/newsfragments/2275.clarification b/changelogs/internal/newsfragments/2275.clarification new file mode 100644 index 00000000..0a0f28a7 --- /dev/null +++ b/changelogs/internal/newsfragments/2275.clarification @@ -0,0 +1 @@ +Auto-create draft releases when building release tags.