diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad38a82..124a191 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,15 @@ jobs: tag="v$version" echo "is_prerelease=false" >> $GITHUB_OUTPUT else - tag="v$version-rc.${{ github.run_number }}" + git fetch --tags --force + existing_rc_tags=$(git tag -l "v$version-rc.*") + if [ -z "$existing_rc_tags" ]; then + next_rc=1 + else + max_rc=$(echo "$existing_rc_tags" | sed -E 's/.*-rc\.([0-9]+)$/\1/' | sort -n | tail -1) + next_rc=$((max_rc + 1)) + fi + tag="v$version-rc.$next_rc" echo "is_prerelease=true" >> $GITHUB_OUTPUT fi echo "tag=$tag" >> $GITHUB_OUTPUT diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c62cfd..c827b76 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,10 +46,10 @@ node scripts/bump-version.js [major|minor|patch] ### Release types -| Branch | Tag | Type | -| --------- | ------------------------ | --------------------------------- | -| `main` | `v1.0.0` | Full release (marked as `latest`) | -| `staging` | `v1.0.0-rc.` | Release candidate (prerelease) | +| Branch | Tag | Type | +| --------- | --------------- | --------------------------------- | +| `main` | `v1.0.0` | Full release (marked as `latest`) | +| `staging` | `v1.0.0-rc.` | Release candidate (prerelease) | ### Artifacts