Skip to content

Commit 7af98d6

Browse files
authored
Defer release tag creation (#1094)
1 parent cc926c8 commit 7af98d6

3 files changed

Lines changed: 10 additions & 28 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,13 @@ jobs:
6868
git config --global user.name "$GITHUB_ACTOR"
6969
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
7070
71-
# Fetch the commit so that it exists locally.
72-
- name: Fetch commit
73-
if: ${{ github.event.inputs.dry-run == 'false' }}
74-
run: git fetch origin ${GITHUB_EVENT_INPUTS_SHA}
75-
env:
76-
GITHUB_EVENT_INPUTS_SHA: ${{ github.event.inputs.sha }}
77-
78-
# Associate the commit with the tag.
79-
- name: Create tag
80-
if: ${{ github.event.inputs.dry-run == 'false' }}
81-
run: git tag ${GITHUB_EVENT_INPUTS_TAG} ${GITHUB_EVENT_INPUTS_SHA}
82-
env:
83-
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
84-
GITHUB_EVENT_INPUTS_SHA: ${{ github.event.inputs.sha }}
85-
- name: Push tag
86-
if: ${{ github.event.inputs.dry-run == 'false' }}
87-
run: git push origin ${GITHUB_EVENT_INPUTS_TAG}
88-
env:
89-
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
90-
91-
# Create a GitHub release.
71+
# Create a GitHub draft release for the target commit.
9272
- name: Create GitHub Release
9373
if: ${{ github.event.inputs.dry-run == 'false' }}
94-
run: just release-create ${GITHUB_EVENT_INPUTS_TAG}
74+
run: just release-create ${GITHUB_EVENT_INPUTS_TAG} ${GITHUB_EVENT_INPUTS_SHA}
9575
env:
9676
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
77+
GITHUB_EVENT_INPUTS_SHA: ${{ github.event.inputs.sha }}
9778

9879
# Uploading the relevant artifact to the GitHub release.
9980
- run: just release-run ${GH_TOKEN} ${GITHUB_EVENT_INPUTS_SHA} ${GITHUB_EVENT_INPUTS_TAG}

CONTRIBUTING.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ Releases
3737
To cut a release, wait for the "MacOS Python build", "Linux Python build", and
3838
"Windows Python build" GitHub Actions to complete successfully on the target commit.
3939

40-
Then, run the "Release" GitHub Action to create a draft release, populate the release artifacts
41-
(by downloading the artifacts from each workflow, and uploading them to the GitHub Release),
42-
publish the release, and promote the SHA via the `latest-release` branch.
40+
Then, run the "Release" GitHub Action to create a draft release for the target commit,
41+
populate the release artifacts (by downloading the artifacts from each workflow, and uploading
42+
them to the GitHub Release), publish the release, and promote the SHA via the `latest-release`
43+
branch.
4344

4445
The "Release" GitHub Action takes, as input, a tag (assumed to be a date in `YYYYMMDD` format) and
4546
the commit SHA referenced above.

Justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ release-set-latest-release tag:
7171

7272
git switch main
7373

74-
# Create a GitHub release object, or reuse an existing draft release.
75-
release-create tag:
74+
# Create a GitHub draft release for the target commit, or reuse an existing draft release.
75+
release-create tag commit:
7676
#!/usr/bin/env bash
7777
set -euo pipefail
7878
draft_exists=$(gh release view {{tag}} --json isDraft -t '{{{{.isDraft}}' 2>&1 || true)
@@ -85,7 +85,7 @@ release-create tag:
8585
exit 1
8686
;;
8787
"release not found")
88-
gh release create {{tag}} --draft --title {{tag}} --notes TBD --verify-tag
88+
gh release create {{tag}} --draft --title {{tag}} --notes TBD --target {{commit}}
8989
;;
9090
*)
9191
echo "error: unexpected gh cli output: $draft_exists"

0 commit comments

Comments
 (0)