Skip to content

Commit 53a1b6d

Browse files
authored
ci: fix Linear release tracking and move complete step to release workflow (#23771)
1 parent 8c8b307 commit 53a1b6d

2 files changed

Lines changed: 37 additions & 41 deletions

File tree

.github/workflows/linear-release.yaml

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
branches:
66
- main
77
- "release/2.[0-9]+"
8-
release:
9-
types: [published]
108

119
permissions:
1210
contents: read
@@ -29,9 +27,9 @@ jobs:
2927

3028
- name: Detect next release version
3129
id: version
32-
# Find the highest release/2.X branch (exact pattern, no suffixes like
33-
# release/2.31_hotfix) and derive the next minor version for the release
34-
# currently in development on main.
30+
# Find the highest release/2.X branch (exact pattern, no suffixes
31+
# like release/2.31_hotfix) and derive the next minor version for
32+
# the release currently in development on main.
3533
run: |
3634
LATEST_MINOR=$(git branch -r | grep -E '^\s*origin/release/2\.[0-9]+$' | \
3735
sed 's/.*release\/2\.//' | sort -n | tail -1)
@@ -40,8 +38,10 @@ jobs:
4038
echo "skip=true" >> "$GITHUB_OUTPUT"
4139
exit 0
4240
fi
43-
echo "version=2.$((LATEST_MINOR + 1))" >> "$GITHUB_OUTPUT"
41+
NEXT="2.$((LATEST_MINOR + 1))"
42+
echo "version=$NEXT" >> "$GITHUB_OUTPUT"
4443
echo "skip=false" >> "$GITHUB_OUTPUT"
44+
echo "Detected next release: $NEXT"
4545
4646
- name: Sync issues
4747
id: sync
@@ -51,6 +51,7 @@ jobs:
5151
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
5252
command: sync
5353
version: ${{ steps.version.outputs.version }}
54+
name: ${{ steps.version.outputs.version }}
5455
timeout: 300
5556

5657
sync-release-branch:
@@ -76,6 +77,7 @@ jobs:
7677
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
7778
command: sync
7879
version: ${{ steps.version.outputs.version }}
80+
name: ${{ steps.version.outputs.version }}
7981
timeout: 300
8082

8183
code-freeze:
@@ -106,38 +108,3 @@ jobs:
106108
version: ${{ steps.version.outputs.version }}
107109
timeout: 300
108110

109-
complete:
110-
name: Complete Linear release
111-
if: github.event_name == 'release'
112-
runs-on: ubuntu-latest
113-
steps:
114-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
115-
with:
116-
persist-credentials: false
117-
118-
- name: Extract release version
119-
id: version
120-
# Strip "v" prefix and patch: "v2.31.0" -> "2.31". Also detect whether
121-
# this is a minor release (v*.*.0) — patch releases (v2.31.1, v2.31.2,
122-
# ...) are grouped into the same Linear release and must not re-complete
123-
# it after it has already shipped.
124-
run: |
125-
VERSION=$(echo "$TAG" | sed 's/^v//' | cut -d. -f1,2)
126-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
127-
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then
128-
echo "is_minor=true" >> "$GITHUB_OUTPUT"
129-
else
130-
echo "is_minor=false" >> "$GITHUB_OUTPUT"
131-
fi
132-
env:
133-
TAG: ${{ github.event.release.tag_name }}
134-
135-
- name: Complete release
136-
id: complete
137-
if: steps.version.outputs.is_minor == 'true'
138-
uses: linear/linear-release-action@755d50b5adb7dd42b976ee9334952745d62ceb2d # v0.6.0
139-
with:
140-
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
141-
command: complete
142-
version: ${{ steps.version.outputs.version }}
143-
timeout: 300

.github/workflows/release.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,35 @@ jobs:
563563
VERSION: ${{ steps.version.outputs.version }}
564564
CREATED_LATEST_TAG: ${{ steps.build_docker.outputs.created_latest_tag }}
565565

566+
# Mark the Linear release as shipped.
567+
- name: Extract Linear release version
568+
if: ${{ !inputs.dry_run }}
569+
id: linear_version
570+
run: |
571+
# Skip RC releases — they must not complete the Linear release.
572+
if [[ "$VERSION" == *-rc* ]]; then
573+
echo "RC release (${VERSION}), skipping Linear release completion."
574+
echo "skip=true" >> "$GITHUB_OUTPUT"
575+
exit 0
576+
fi
577+
# Strip patch to get the Linear release version (e.g. 2.32.0 -> 2.32).
578+
linear_version=$(echo "$VERSION" | cut -d. -f1,2)
579+
echo "version=$linear_version" >> "$GITHUB_OUTPUT"
580+
echo "skip=false" >> "$GITHUB_OUTPUT"
581+
echo "Completing Linear release ${linear_version}"
582+
env:
583+
VERSION: ${{ steps.version.outputs.version }}
584+
585+
- name: Complete Linear release
586+
if: ${{ !inputs.dry_run && steps.linear_version.outputs.skip != 'true' }}
587+
continue-on-error: true
588+
uses: linear/linear-release-action@755d50b5adb7dd42b976ee9334952745d62ceb2d # v0.6.0
589+
with:
590+
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
591+
command: complete
592+
version: ${{ steps.linear_version.outputs.version }}
593+
timeout: 300
594+
566595
- name: Authenticate to Google Cloud
567596
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
568597
with:

0 commit comments

Comments
 (0)