Skip to content

Commit 1903220

Browse files
committed
Use gh release instead of someone's release action
The upstream action times out because it requests every release (without pagination), and there's no real need to use a third-party action for this when the `gh` command does a perfectly fine job too.
1 parent c7bc21c commit 1903220

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- run: just release-dry-run ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.sha }} ${{ github.event.inputs.tag }}
4242
if: ${{ github.event.inputs.dry-run == 'true' }}
4343

44-
# Create the release itself.
44+
# Set our identity for git operations (on the latest-release branch).
4545
- name: Configure Git identity
4646
if: ${{ github.event.inputs.dry-run == 'false' }}
4747
run: |
@@ -66,14 +66,7 @@ jobs:
6666
# Create a GitHub release.
6767
- name: Create GitHub Release
6868
if: ${{ github.event.inputs.dry-run == 'false' }}
69-
uses: ncipollo/release-action@v1
70-
with:
71-
tag: ${{ github.event.inputs.tag }}
72-
name: ${{ github.event.inputs.tag }}
73-
prerelease: true
74-
body: TBD
75-
allowUpdates: true
76-
updateOnlyUnreleased: true
69+
run: just release-create ${{ github.events.input.tag }}
7770

7871
# Uploading the relevant artifact to the GitHub release.
7972
- run: just release-run ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.sha }} ${{ github.event.inputs.tag }}

Justfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,28 @@ release-set-latest-release tag:
6767
echo "No changes to commit."
6868
fi
6969

70+
# Create a GitHub release object, or reuse an existing prerelease.
71+
release-create tag:
72+
#!/usr/bin/env bash
73+
set -euo pipefail
74+
prerelease_exists=$(gh release view {{tag}} --json isPrerelease -t '{{{{.isPrerelease}}' 2>&1 || true)
75+
case "$prerelease_exists" in
76+
true)
77+
echo "note: updating existing prerelease {{tag}}"
78+
;;
79+
false)
80+
echo "error: release {{tag}} already exists"
81+
exit 1
82+
;;
83+
"release not found")
84+
gh release create {{tag}} --prerelease --notes TBD --verify-tag
85+
;;
86+
*)
87+
echo "error: unexpected gh cli output: $prerelease_exists"
88+
exit 1
89+
;;
90+
esac
91+
7092
# Perform the release job. Assumes that the GitHub Release has been created.
7193
release-run token commit tag:
7294
#!/bin/bash

0 commit comments

Comments
 (0)