diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index befa4ca47..cf64626c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,32 +60,13 @@ jobs: git config --global user.name "$GITHUB_ACTOR" git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - # Fetch the commit so that it exists locally. - - name: Fetch commit - if: ${{ github.event.inputs.dry-run == 'false' }} - run: git fetch origin ${GITHUB_EVENT_INPUTS_SHA} - env: - GITHUB_EVENT_INPUTS_SHA: ${{ github.event.inputs.sha }} - - # Associate the commit with the tag. - - name: Create tag - if: ${{ github.event.inputs.dry-run == 'false' }} - run: git tag ${GITHUB_EVENT_INPUTS_TAG} ${GITHUB_EVENT_INPUTS_SHA} - env: - GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }} - GITHUB_EVENT_INPUTS_SHA: ${{ github.event.inputs.sha }} - - name: Push tag - if: ${{ github.event.inputs.dry-run == 'false' }} - run: git push origin ${GITHUB_EVENT_INPUTS_TAG} - env: - GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }} - - # Create a GitHub release. + # Create a GitHub draft release for the target commit. - name: Create GitHub Release if: ${{ github.event.inputs.dry-run == 'false' }} - run: just release-create ${GITHUB_EVENT_INPUTS_TAG} + run: just release-create ${GITHUB_EVENT_INPUTS_TAG} ${GITHUB_EVENT_INPUTS_SHA} env: GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }} + GITHUB_EVENT_INPUTS_SHA: ${{ github.event.inputs.sha }} # Uploading the relevant artifact to the GitHub release. - run: just release-run ${GH_TOKEN} ${GITHUB_EVENT_INPUTS_SHA} ${GITHUB_EVENT_INPUTS_TAG} diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 6f656e95c..c7e0193b5 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -37,9 +37,10 @@ Releases To cut a release, wait for the "MacOS Python build", "Linux Python build", and "Windows Python build" GitHub Actions to complete successfully on the target commit. -Then, run the "Release" GitHub Action to create a draft release, populate the release artifacts -(by downloading the artifacts from each workflow, and uploading them to the GitHub Release), -publish the release, and promote the SHA via the `latest-release` branch. +Then, run the "Release" GitHub Action to create a draft release for the target commit, +populate the release artifacts (by downloading the artifacts from each workflow, and uploading +them to the GitHub Release), publish the release, and promote the SHA via the `latest-release` +branch. The "Release" GitHub Action takes, as input, a tag (assumed to be a date in `YYYYMMDD` format) and the commit SHA referenced above. diff --git a/Justfile b/Justfile index 4c32d04fc..56acfa306 100644 --- a/Justfile +++ b/Justfile @@ -71,8 +71,8 @@ release-set-latest-release tag: git switch main -# Create a GitHub release object, or reuse an existing draft release. -release-create tag: +# Create a GitHub draft release for the target commit, or reuse an existing draft release. +release-create tag commit: #!/usr/bin/env bash set -euo pipefail draft_exists=$(gh release view {{tag}} --json isDraft -t '{{{{.isDraft}}' 2>&1 || true) @@ -85,7 +85,7 @@ release-create tag: exit 1 ;; "release not found") - gh release create {{tag}} --draft --title {{tag}} --notes TBD --verify-tag + gh release create {{tag}} --draft --title {{tag}} --notes TBD --target {{commit}} ;; *) echo "error: unexpected gh cli output: $draft_exists"