-
Notifications
You must be signed in to change notification settings - Fork 662
fix(ci): use supported release workflow concurrency #324
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
83848e1
617bd65
b3b5f86
effc83b
a023a41
f1faf71
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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| name: node-github-release | ||
| run-name: GitHub release ${{ inputs.tag }} | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
@@ -16,8 +17,8 @@ permissions: | |
| contents: read | ||
|
|
||
| concurrency: | ||
| group: node-github-release | ||
| queue: max | ||
| group: node-github-release-${{ inputs.tag }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| release: | ||
|
|
@@ -392,6 +393,47 @@ jobs: | |
| printf 'make-latest=%s\n' "$make_latest" | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Wait for older GitHub releases | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_VERSION: ${{ steps.release.outputs.version }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| for attempt in {1..120}; do | ||
| waiting= | ||
| active_runs="$( | ||
| gh api --paginate \ | ||
| "repos/$GITHUB_REPOSITORY/actions/workflows/node-github-release.yml/runs?per_page=100" \ | ||
| --jq '.workflow_runs[] | select(.status != "completed") | [.id, (.display_title // ""), .run_number] | @tsv' | ||
|
Comment on lines
+407
to
+409
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In a repository with a long release history, this invocation fetches every historical page before the local jq expression discards completed runs; checked Useful? React with 👍 / 👎. |
||
| )" | ||
| while IFS=$'\t' read -r run_id run_name run_number; do | ||
| [[ -n "$run_id" && "$run_id" != "$GITHUB_RUN_ID" ]] || continue | ||
| if [[ "$run_name" == "GitHub release npm-v"* ]]; then | ||
| candidate="${run_name#GitHub release npm-v}" | ||
| node sdk/typescript/scripts/release-automation.mjs \ | ||
| require-increase "$RELEASE_VERSION" "$candidate" \ | ||
| >/dev/null 2>&1 || continue | ||
| elif [[ ! "$run_number" =~ ^[0-9]+$ || | ||
| "$run_number" -ge "$GITHUB_RUN_NUMBER" ]]; then | ||
| continue | ||
| fi | ||
| waiting="$run_id" | ||
| break | ||
| done <<< "$active_runs" | ||
|
|
||
| if [[ -z "$waiting" ]]; then | ||
| echo "No older GitHub release is still running." | ||
| break | ||
| fi | ||
| if [[ "$attempt" == 120 ]]; then | ||
| echo "Timed out waiting for older GitHub release run $waiting." >&2 | ||
| exit 1 | ||
| fi | ||
| sleep 15 | ||
| done | ||
|
|
||
| - name: Publish GitHub Release and generated notes | ||
| shell: bash | ||
| env: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,8 @@ on: | |
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }} | ||
| queue: max | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
|
mldangelo-oai marked this conversation as resolved.
|
||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| verify: | ||
|
|
@@ -218,6 +218,7 @@ jobs: | |
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| actions: read | ||
|
|
||
| steps: | ||
| - name: Checkout release verification source | ||
|
|
@@ -331,6 +332,44 @@ jobs: | |
| "$GITHUB_SHA" \ | ||
| "$GITHUB_REPOSITORY" | ||
|
|
||
| - name: Wait for older npm releases | ||
| if: needs.verify.outputs.mode == 'publish' | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_VERSION: ${{ needs.verify.outputs.version }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| for attempt in {1..120}; do | ||
| waiting= | ||
| active_runs="$( | ||
| gh api --paginate \ | ||
| "repos/$GITHUB_REPOSITORY/actions/workflows/node-release.yml/runs?per_page=100" \ | ||
| --jq '.workflow_runs[] | select(.status != "completed") | [.id, (.head_branch // "")] | @tsv' | ||
| )" | ||
|
Comment on lines
+346
to
+350
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When release-cut runs complete out of version order, a lower-version Useful? React with 👍 / 👎. |
||
| while IFS=$'\t' read -r run_id ref_name; do | ||
| [[ -n "$run_id" && "$run_id" != "$GITHUB_RUN_ID" ]] || continue | ||
| [[ "$ref_name" == npm-v* ]] || continue | ||
| candidate="${ref_name#npm-v}" | ||
| if node sdk/typescript/scripts/release-automation.mjs \ | ||
| require-increase "$RELEASE_VERSION" "$candidate" >/dev/null 2>&1; then | ||
| waiting="$run_id" | ||
| break | ||
| fi | ||
| done <<< "$active_runs" | ||
|
|
||
| if [[ -z "$waiting" ]]; then | ||
| echo "No older npm release is still running." | ||
| break | ||
| fi | ||
| if [[ "$attempt" == 120 ]]; then | ||
| echo "Timed out waiting for older npm release run $waiting." >&2 | ||
| exit 1 | ||
| fi | ||
| sleep 15 | ||
| done | ||
|
|
||
| - name: Revalidate protected release tag | ||
| if: needs.verify.outputs.mode == 'publish' | ||
| shell: bash | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.