Skip to content

Commit 6db0616

Browse files
authored
ci: release a stack once, when its last PR merges (#248)
1 parent b5992be commit 6db0616

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,21 @@ jobs:
7070
working-directory: shotstack-studio-extended-regression-suite
7171
run: npm test
7272

73+
# A stack releases once, when its last PR merges: semantic-release then reads every commit since the
74+
# last release. Earlier PRs in the stack, titled [n/m] with n < m, hold the release.
75+
- name: Hold the release for an unfinished stack
76+
id: stack
77+
env:
78+
GH_TOKEN: ${{ github.token }}
79+
run: |
80+
title=$(gh api "repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" --jq '.[0].title // ""')
81+
if [[ "$title" =~ ^\[([0-9]+)/([0-9]+)\] ]] && (( BASH_REMATCH[1] < BASH_REMATCH[2] )); then
82+
echo "hold=true" >> "$GITHUB_OUTPUT"
83+
echo "Holding the release until the stack's last PR merges: $title"
84+
fi
85+
7386
- name: Release
87+
if: steps.stack.outputs.hold != 'true'
7488
working-directory: shotstack-studio-sdk
7589
env:
7690
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)