44 push :
55 branches :
66 - main
7- # This event reads the workflow from the default branch (main), not the
8- # release branch. No cherry-pick needed.
9- # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
7+ - " release/2.[0-9]+"
108 release :
119 types : [published]
1210
@@ -18,28 +16,94 @@ concurrency:
1816 cancel-in-progress : true
1917
2018jobs :
21- sync :
22- name : Sync issues to Linear release
23- if : github.event_name == 'push'
19+ sync-main :
20+ name : Sync issues to next Linear release
21+ if : github.event_name == 'push' && github.ref_name == 'main'
2422 runs-on : ubuntu-latest
2523 steps :
2624 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2725 with :
2826 fetch-depth : 0
2927 persist-credentials : false
3028
29+ - name : Detect next release version
30+ id : version
31+ # Find the highest release/2.X branch (exact pattern, no suffixes like
32+ # release/2.31_hotfix) and derive the next minor version for the release
33+ # currently in development on main.
34+ run : |
35+ LATEST_MINOR=$(git branch -r | grep -E '^\s*origin/release/2\.[0-9]+$' | \
36+ sed 's/.*release\/2\.//' | sort -n | tail -1)
37+ if [ -z "$LATEST_MINOR" ]; then
38+ echo "No release branch found, skipping sync."
39+ echo "skip=true" >> "$GITHUB_OUTPUT"
40+ exit 0
41+ fi
42+ echo "version=2.$((LATEST_MINOR + 1))" >> "$GITHUB_OUTPUT"
43+ echo "skip=false" >> "$GITHUB_OUTPUT"
44+
3145 - name : Sync issues
3246 id : sync
33- uses : linear/linear-release-action@5cbaabc187ceb63eee9d446e62e68e5c29a03ae8 # v0.5.0
47+ if : steps.version.outputs.skip != 'true'
48+ uses : linear/linear-release-action@755d50b5adb7dd42b976ee9334952745d62ceb2d # v0.6.0
3449 with :
3550 access_key : ${{ secrets.LINEAR_ACCESS_KEY }}
3651 command : sync
52+ version : ${{ steps.version.outputs.version }}
53+ timeout : 300
3754
38- - name : Print release URL
39- if : steps.sync.outputs.release-url
40- run : echo "Synced to $RELEASE_URL"
41- env :
42- RELEASE_URL : ${{ steps.sync.outputs.release-url }}
55+ sync-release-branch :
56+ name : Sync backports to Linear release
57+ if : github.event_name == 'push' && startsWith(github.ref_name, 'release/')
58+ runs-on : ubuntu-latest
59+ steps :
60+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
61+ with :
62+ fetch-depth : 0
63+ persist-credentials : false
64+
65+ - name : Extract release version
66+ id : version
67+ # The trigger only allows exact release/2.X branch names.
68+ run : |
69+ echo "version=${GITHUB_REF_NAME#release/}" >> "$GITHUB_OUTPUT"
70+
71+ - name : Sync issues
72+ id : sync
73+ uses : linear/linear-release-action@755d50b5adb7dd42b976ee9334952745d62ceb2d # v0.6.0
74+ with :
75+ access_key : ${{ secrets.LINEAR_ACCESS_KEY }}
76+ command : sync
77+ version : ${{ steps.version.outputs.version }}
78+ timeout : 300
79+
80+ code-freeze :
81+ name : Move Linear release to Code Freeze
82+ needs : sync-release-branch
83+ if : >
84+ github.event_name == 'push' &&
85+ startsWith(github.ref_name, 'release/') &&
86+ github.event.created == true
87+ runs-on : ubuntu-latest
88+ steps :
89+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
90+ with :
91+ persist-credentials : false
92+
93+ - name : Extract release version
94+ id : version
95+ run : |
96+ echo "version=${GITHUB_REF_NAME#release/}" >> "$GITHUB_OUTPUT"
97+
98+ - name : Move to Code Freeze
99+ id : update
100+ uses : linear/linear-release-action@755d50b5adb7dd42b976ee9334952745d62ceb2d # v0.6.0
101+ with :
102+ access_key : ${{ secrets.LINEAR_ACCESS_KEY }}
103+ command : update
104+ stage : Code Freeze
105+ version : ${{ steps.version.outputs.version }}
106+ timeout : 300
43107
44108 complete :
45109 name : Complete Linear release
@@ -50,16 +114,29 @@ jobs:
50114 with :
51115 persist-credentials : false
52116
117+ - name : Extract release version
118+ id : version
119+ # Strip "v" prefix and patch: "v2.31.0" -> "2.31". Also detect whether
120+ # this is a minor release (v*.*.0) — patch releases (v2.31.1, v2.31.2,
121+ # ...) are grouped into the same Linear release and must not re-complete
122+ # it after it has already shipped.
123+ run : |
124+ VERSION=$(echo "$TAG" | sed 's/^v//' | cut -d. -f1,2)
125+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
126+ if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then
127+ echo "is_minor=true" >> "$GITHUB_OUTPUT"
128+ else
129+ echo "is_minor=false" >> "$GITHUB_OUTPUT"
130+ fi
131+ env :
132+ TAG : ${{ github.event.release.tag_name }}
133+
53134 - name : Complete release
54135 id : complete
55- uses : linear/linear-release-action@5cbaabc187ceb63eee9d446e62e68e5c29a03ae8 # v0
136+ if : steps.version.outputs.is_minor == 'true'
137+ uses : linear/linear-release-action@755d50b5adb7dd42b976ee9334952745d62ceb2d # v0.6.0
56138 with :
57139 access_key : ${{ secrets.LINEAR_ACCESS_KEY }}
58140 command : complete
59- version : ${{ github.event.release.tag_name }}
60-
61- - name : Print release URL
62- if : steps.complete.outputs.release-url
63- run : echo "Completed $RELEASE_URL"
64- env :
65- RELEASE_URL : ${{ steps.complete.outputs.release-url }}
141+ version : ${{ steps.version.outputs.version }}
142+ timeout : 300
0 commit comments