-
Notifications
You must be signed in to change notification settings - Fork 88
ci: add manual release workflow for non-version-bump improvements #471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fzipi
wants to merge
1
commit into
main
Choose a base branch
from
ci/manual-release-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Shared by auto-release.yml (version-bump trigger) and release.yml (manual | ||
| # dispatch): create a date-based (release/YYYYMMDD) GitHub release tag, with a | ||
| # numeric suffix on a same-day re-release, or an explicit override tag. | ||
| name: cut-release | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| tag: | ||
| description: "Override tag; empty uses release/YYYYMMDD with a numeric suffix on collision." | ||
| required: false | ||
| type: string | ||
| default: "" | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| cut: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # actions/checkout@v5 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Create release tag and GitHub release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| GH_REPO: ${{ github.repository }} | ||
| OVERRIDE: ${{ inputs.tag }} | ||
| SHA: ${{ github.sha }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| # 0 = the tag exists; 1 = confirmed absent (HTTP 404). Any other | ||
| # failure (network, rate limit, auth) aborts the job -- a lookup we | ||
| # can't complete must never be mistaken for "tag is free". | ||
| tag_taken() { | ||
| local out | ||
| if out="$(gh api "repos/${GH_REPO}/git/ref/tags/$1" 2>&1)"; then | ||
| return 0 | ||
| fi | ||
| if printf '%s\n' "$out" | grep -qiE 'HTTP 404|Not Found'; then | ||
| return 1 | ||
| fi | ||
| echo "::error::tag lookup for '$1' failed: ${out}" | ||
| exit 1 | ||
| } | ||
|
|
||
| if [ -n "${OVERRIDE}" ]; then | ||
| tag="${OVERRIDE}" | ||
| if tag_taken "${tag}"; then | ||
| echo "::error::tag ${tag} already exists"; exit 1 | ||
| fi | ||
| else | ||
| base="release/$(date -u +%Y%m%d)" | ||
| tag="${base}"; n=1 | ||
| while tag_taken "${tag}"; do | ||
| tag="${base}-${n}"; n=$((n + 1)) | ||
| done | ||
| fi | ||
|
|
||
| echo "Cutting release ${tag} at ${SHA}" | ||
| gh release create "${tag}" \ | ||
| --target "${SHA}" \ | ||
| --title "${tag}" \ | ||
| --generate-notes | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Manual release, for improvements that don't bump a tracked upstream | ||
| # version and so wouldn't trigger auto-release.yml. | ||
| name: release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "Override tag (default: release/YYYYMMDD). Must not already exist." | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| # Shared with auto-release.yml so it can't allocate the same tag. | ||
| group: release-tag-creation | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| tag-and-release: | ||
| permissions: | ||
| contents: write | ||
| uses: ./.github/workflows/cut-release.yml | ||
| with: | ||
| tag: ${{ inputs.tag }} | ||
|
|
||
| publish: | ||
| needs: tag-and-release | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| id-token: write | ||
| uses: ./.github/workflows/publish.yml | ||
| secrets: | ||
| dockerhub_user: ${{ secrets.dockerhub_user }} | ||
| dockerhub_token: ${{ secrets.dockerhub_token }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Match the HTTP status exactly before marking the tag absent.
Line 45 accepts any failed response that contains
Not Found. A non-404 API or proxy error body can contain this text. The function then returns absent andgh release createcan run after an unconfirmed lookup. Parse the response status and return1only for an exact HTTP 404 response.🤖 Prompt for AI Agents