-
Notifications
You must be signed in to change notification settings - Fork 10
🐛 Enhance release workflow to support manual dispatch and prevent duplicate tags #185
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,14 +6,17 @@ on: | |||||
| push: | ||||||
| branches: | ||||||
| - release/** | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| permissions: | ||||||
| contents: write | ||||||
| packages: write | ||||||
|
|
||||||
| jobs: | ||||||
| release: | ||||||
| if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') | ||||||
| if: >- | ||||||
| github.event_name == 'workflow_dispatch' || | ||||||
| (github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')) | ||||||
| name: Create Release | ||||||
| runs-on: ubuntu-24.04-arm | ||||||
| steps: | ||||||
|
|
@@ -35,8 +38,20 @@ jobs: | |||||
| run: | | ||||||
| task lint | ||||||
| task git:set-config | ||||||
| task version:tag-release | ||||||
| echo "REL_VERSION=$(task version:get)" >> "$GITHUB_OUTPUT" | ||||||
| REL_VERSION="$(task version:get)" | ||||||
| echo "REL_VERSION=${REL_VERSION}" >> "$GITHUB_OUTPUT" | ||||||
|
|
||||||
| full_remote_sha="$(git ls-remote --tags origin "refs/tags/${REL_VERSION}" 2>/dev/null | awk '{print $1}' || true)" | ||||||
| if [ -n "${full_remote_sha}" ]; then | ||||||
| if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then | ||||||
|
||||||
| if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
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.
The job condition allows execution on 'push' events to 'release/**' branches, but there is no check in the condition to handle this trigger type. The condition only checks for 'workflow_dispatch' or merged pull requests starting with 'release/'.
When a push event occurs to a 'release/**' branch, both parts of the OR condition will be false:
github.event_name == 'workflow_dispatch'will be false (it's a 'push' event)github.event.pull_request.merged == truewill be false (push events don't have pull_request data)This means the job will never run for push events to release branches, even though they are listed as a trigger. Either remove the push trigger or add it to the condition, such as: