Skip to content

Commit 416de50

Browse files
committed
👷 github: track sentry release commits via tag ranges
1 parent 77abfd3 commit 416de50

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

‎.github/workflows/mobile-expo.yaml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,20 @@ jobs:
6060
SENTRY_PROJECT: exa
6161
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
6262
SENTRY_RELEASE: ${{ steps.release.outputs.release }}
63+
- id: commits
64+
if: inputs.profile == 'production'
65+
run: |
66+
currentTag="$GITHUB_REF_NAME"
67+
previousTag=$(git for-each-ref 'refs/tags/@exactly/mobile@*' --sort=-version:refname --format='%(refname:short)' | while read -r tag; do [ "$tag" = "$currentTag" ] && continue; git merge-base --is-ancestor "$tag" "$GITHUB_SHA" && { echo "$tag"; break; }; done)
68+
if [ -n "$previousTag" ]; then
69+
echo "mode=manual" >> "$GITHUB_OUTPUT"
70+
echo "repo=$GITHUB_REPOSITORY" >> "$GITHUB_OUTPUT"
71+
echo "commit=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
72+
echo "previous_commit=$(git rev-list -n 1 "$previousTag")" >> "$GITHUB_OUTPUT"
73+
echo "previous_tag=$previousTag" >> "$GITHUB_OUTPUT"
74+
else
75+
echo "mode=auto" >> "$GITHUB_OUTPUT"
76+
fi
6377
- uses: getsentry/action-release@v3 # cspell:ignore getsentry
6478
if: inputs.profile == 'production'
6579
env:
@@ -68,4 +82,8 @@ jobs:
6882
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
6983
with:
7084
environment: ${{ inputs.profile }}
85+
commit: ${{ steps.commits.outputs.commit }}
86+
previous_commit: ${{ steps.commits.outputs.previous_commit }}
87+
repo: ${{ steps.commits.outputs.repo }}
7188
release: ${{ steps.release.outputs.release }}
89+
set_commits: ${{ steps.commits.outputs.mode }}

‎.github/workflows/server-build.yaml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,29 @@ jobs:
5858
docker rm extract
5959
echo "release=$(node -e 'console.log(require(`./server/generated/release`))')" >> $GITHUB_OUTPUT
6060
id: extract
61+
- id: commits
62+
if: inputs.environment == 'production'
63+
run: |
64+
currentTag="$GITHUB_REF_NAME"
65+
previousTag=$(git for-each-ref 'refs/tags/@exactly/server@*' --sort=-version:refname --format='%(refname:short)' | while read -r tag; do [ "$tag" = "$currentTag" ] && continue; git merge-base --is-ancestor "$tag" "$GITHUB_SHA" && { echo "$tag"; break; }; done)
66+
if [ -n "$previousTag" ]; then
67+
echo "mode=manual" >> "$GITHUB_OUTPUT"
68+
echo "repo=$GITHUB_REPOSITORY" >> "$GITHUB_OUTPUT"
69+
echo "commit=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
70+
echo "previous_commit=$(git rev-list -n 1 "$previousTag")" >> "$GITHUB_OUTPUT"
71+
echo "previous_tag=$previousTag" >> "$GITHUB_OUTPUT"
72+
else
73+
echo "mode=auto" >> "$GITHUB_OUTPUT"
74+
fi
6175
- uses: getsentry/action-release@v3 # cspell:ignore getsentry
6276
if: inputs.environment == 'production'
6377
env: { SENTRY_ORG: exactly, SENTRY_PROJECT: server, SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" }
6478
with:
79+
commit: ${{ steps.commits.outputs.commit }}
6580
environment: ${{ inputs.environment }}
81+
previous_commit: ${{ steps.commits.outputs.previous_commit }}
82+
repo: ${{ steps.commits.outputs.repo }}
6683
release: ${{ steps.extract.outputs.release }}
84+
set_commits: ${{ steps.commits.outputs.mode }}
6785
sourcemaps: server/dist
6886
inject: false

0 commit comments

Comments
 (0)