@@ -3,6 +3,9 @@ name: Sync JNI Branch
33on :
44 release :
55 types : [published]
6+ push :
7+ branches :
8+ - deps/jni-0.15.x
69
710env :
811 JNI_BRANCH : deps/jni-0.15.x
2023 sync :
2124 runs-on : ubuntu-latest
2225 timeout-minutes : 30
23- if : ${{ !github.event.release.prerelease }}
26+ if : >-
27+ github.event_name == 'release' &&
28+ !github.event.release.prerelease
2429
2530 steps :
2631 - name : Get auth token
@@ -110,42 +115,6 @@ jobs:
110115 --title "Sync JNI branch with release $TAG" \
111116 --body-file /tmp/pr-body.md
112117
113- - name : Update version tracker on issue
114- if : steps.regenerate.outcome == 'success'
115- env :
116- GH_TOKEN : ${{ steps.token.outputs.token }}
117- TAG : ${{ steps.release.outputs.tag }}
118- run : |
119- COMMIT_SHA="$(git rev-parse HEAD)"
120- SHORT_SHA="$(git rev-parse --short HEAD)"
121- REPO="${{ github.repository }}"
122- DATE="$(date -u +%Y-%m-%d)"
123- NEW_ROW="| \`$TAG\` | [\`$SHORT_SHA\`](https://github.com/$REPO/commit/$COMMIT_SHA) | $DATE |"
124-
125- # Fetch current issue body
126- gh issue view 3373 --json body --jq .body > /tmp/issue-body.txt
127-
128- # Check if the version tracking table already exists
129- if grep -q "<!-- jni-version-tracker -->" /tmp/issue-body.txt; then
130- # Insert new row after the table header separator (|---|---|---|)
131- # Use awk to avoid sed escaping issues with pipes and backticks
132- awk -v row="$NEW_ROW" '/^\|[-[:space:]|]+\|$/ && found { print; print row; found=0; next } /<!-- jni-version-tracker -->/ { found=1 } { print }' /tmp/issue-body.txt > /tmp/issue-body-updated.txt
133- else
134- # Append a new table to the issue body
135- cp /tmp/issue-body.txt /tmp/issue-body-updated.txt
136- {
137- echo ""
138- echo "<!-- jni-version-tracker -->"
139- echo "## Version Tracking"
140- echo ""
141- echo "| Version | Commit | Date |"
142- echo "|---------|--------|------|"
143- echo "$NEW_ROW"
144- } >> /tmp/issue-body-updated.txt
145- fi
146-
147- gh issue edit 3373 --body-file /tmp/issue-body-updated.txt
148-
149118 - name : Create issue on failure
150119 if : steps.regenerate.outcome == 'failure'
151120 env :
@@ -177,3 +146,72 @@ jobs:
177146 gh issue create \
178147 --title "JNI branch sync failed for release $TAG" \
179148 --body-file /tmp/issue-body.md
149+
150+ update-tracker :
151+ runs-on : ubuntu-latest
152+ if : github.event_name == 'push'
153+ steps :
154+ - name : Checkout
155+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
156+ with :
157+ fetch-depth : 10
158+
159+ - name : Extract version from merge commit
160+ id : version
161+ run : |
162+ # Look for "Merge release X.Y.Z" in recent commit messages
163+ TAG="$(git log --oneline -10 --grep='Merge release' | head -1 | sed -n 's/.*Merge release \([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')"
164+ if [ -z "$TAG" ]; then
165+ echo "No release merge commit found in recent history, skipping tracker update"
166+ echo "skip=true" >> $GITHUB_OUTPUT
167+ else
168+ echo "tag=$TAG" >> $GITHUB_OUTPUT
169+ echo "skip=false" >> $GITHUB_OUTPUT
170+ echo "Found version: $TAG"
171+ fi
172+
173+ - name : Get auth token
174+ if : steps.version.outputs.skip != 'true'
175+ id : token
176+ uses : actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
177+ with :
178+ app-id : ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
179+ private-key : ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
180+
181+ - name : Update version tracker on issue
182+ if : steps.version.outputs.skip != 'true'
183+ env :
184+ GH_TOKEN : ${{ steps.token.outputs.token }}
185+ TAG : ${{ steps.version.outputs.tag }}
186+ run : |
187+ COMMIT_SHA="${{ github.sha }}"
188+ SHORT_SHA="${COMMIT_SHA:0:7}"
189+ REPO="${{ github.repository }}"
190+ DATE="$(date -u +%Y-%m-%d)"
191+ NEW_ROW="| \`$TAG\` | [\`$SHORT_SHA\`](https://github.com/$REPO/commit/$COMMIT_SHA) | $DATE |"
192+
193+ # Fetch current issue body
194+ gh issue view 3373 --repo "$REPO" --json body --jq .body > /tmp/issue-body.txt
195+
196+ # Check if the version tracking table already exists
197+ if grep -q "<!-- jni-version-tracker -->" /tmp/issue-body.txt; then
198+ # Insert new row after the table header separator (|---|---|---|)
199+ awk -v row="$NEW_ROW" \
200+ '/^\|[-[:space:]|]+\|$/ && found { print; print row; found=0; next }
201+ /<!-- jni-version-tracker -->/ { found=1 }
202+ { print }' /tmp/issue-body.txt > /tmp/issue-body-updated.txt
203+ else
204+ # Append a new table to the issue body
205+ cp /tmp/issue-body.txt /tmp/issue-body-updated.txt
206+ {
207+ echo ""
208+ echo "<!-- jni-version-tracker -->"
209+ echo "## Version Tracking"
210+ echo ""
211+ echo "| Version | Commit | Date |"
212+ echo "|---------|--------|------|"
213+ echo "$NEW_ROW"
214+ } >> /tmp/issue-body-updated.txt
215+ fi
216+
217+ gh issue edit 3373 --repo "$REPO" --body-file /tmp/issue-body-updated.txt
0 commit comments