Skip to content

Commit 20c690d

Browse files
authored
Use tag and abbrev as version in container and Sentry (#701)
* Use tag and abbrev as version in container and Sentry * Set tag as version https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable * Fetch tags in checkout action
1 parent b762003 commit 20c690d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/build-publish.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ jobs:
1919
steps:
2020
- name: Check out the repo
2121
uses: actions/checkout@v3
22-
22+
with:
23+
fetch-depth: 0 # Fetch everything (tags)
24+
- name: Set tag version
25+
run: echo "JBI_TAG=$(git describe --tags --abbrev=4)" >> $GITHUB_ENV
2326
- name: Build `version.json` file
2427
run: |
2528
printf '{\n "commit": "%s",\n "version": "%s",\n "source": "%s",\n "build": "%s"\n}\n' \
2629
"$GITHUB_SHA" \
27-
"$GITHUB_REF" \
30+
"$JBI_TAG" \
2831
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
2932
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > ./version.json
3033

jbi/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def traces_sampler(sampling_context: dict[str, Any]) -> float:
3434
sentry_sdk.init(
3535
dsn=str(settings.sentry_dsn) if settings.sentry_dsn else None,
3636
traces_sampler=traces_sampler,
37+
release=version_info["version"],
3738
)
3839

3940

0 commit comments

Comments
 (0)