Skip to content

Commit 9bcdcd4

Browse files
ci(workflows): align release creation target (#13)
- release workflow uses the branch so release creation stays aligned - watch-full polls for a run id before watching and hints when absent
1 parent 6047040 commit 9bcdcd4

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- run: |
5656
./gradlew publishAllPublicationsToStagingRepository
5757
export STAGING=$(printf "%s" $(./gradlew stagingPath --quiet))
58-
gh release create ${{ github.event.workflow_run.head_sha }} --generate-notes $STAGING/* --verify-tag
58+
gh release create ${{ github.event.workflow_run.head_branch }} --generate-notes $STAGING/* --verify-tag
5959
if: ${{ steps.detect-tag.outputs.is_tag == 'true' }}
6060
env:
6161
GH_TOKEN: ${{ github.token }}

Makefile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,26 @@ merge-squash:
8888
gh pr merge --squash --delete-branch --auto
8989

9090
watch-full:
91-
@gh run watch $$($(call gh_head_run_id, "full")) --exit-status
91+
@set -e; \
92+
wf="full"; \
93+
commit="$(HEAD)"; \
94+
printf '%s\n' "Waiting for workflow '$$wf' run for commit $$commit..."; \
95+
attempts=0; \
96+
max_attempts=$${GH_WATCH_MAX_ATTEMPTS:-40}; \
97+
sleep_seconds=$${GH_WATCH_SLEEP_SECONDS:-3}; \
98+
run_id=""; \
99+
while [ $$attempts -lt $$max_attempts ]; do \
100+
run_id=$$(gh run list --workflow "$$wf" --commit "$$commit" --json databaseId --jq '.[0].databaseId // empty'); \
101+
if [ -n "$$run_id" ]; then \
102+
break; \
103+
fi; \
104+
attempts=$$((attempts+1)); \
105+
sleep $$sleep_seconds; \
106+
done; \
107+
if [ -z "$$run_id" ]; then \
108+
printf '%s\n' "ERROR: No '$$wf' run found for commit $$commit after $$((attempts*sleep_seconds)) seconds." 1>&2; \
109+
printf '%s\n' "Hint: ensure the workflow triggers include this branch/PR event." 1>&2; \
110+
exit 1; \
111+
fi; \
112+
printf '%s\n' "Found run ID $$run_id. Watching..."; \
113+
gh run watch "$$run_id" --exit-status

0 commit comments

Comments
 (0)