Track Sentry Releases from RWX
Sentry's sentry-cli connects your RWX release pipeline to Sentry's release management. It creates a release in Sentry, associates the commits that make up the release, optionally uploads source maps, and records each deploy, so errors are linked back to the version of your code that produced them.
Prerequisites
-
Install a repository integration in Sentry so commit metadata can be associated with releases.
-
Create an internal integration in Sentry under Settings > Developer Settings > New Internal Integration with
Release: AdminandOrganization: Readpermissions, and copy the generated auth token. -
Store the auth token as a secret in an RWX vault. For example, in the default vault:
rwx vaults secrets set sentry-auth-token=sntrys_...You'll reference it from a run as
${{ secrets.sentry-auth-token }}.
Create a release on every deploy
Run sentry-cli after a successful deploy to create a release, associate its commits, and record the deploy. Each run creates a new release named after the commit SHA by default.
This example runs on every push to GitHub, after a hypothetical deploy task succeeds:
on:
github:
push:
init:
commit-sha: ${{ event.git.sha }}
base:
image: ubuntu:24.04
config: rwx/base 1.0.2
tasks:
- key: code
call: git/clone 2.0.7
with:
repository: https://github.com/YOUR-ORG/YOUR-REPO.git
ref: ${{ init.commit-sha }}
github-token: ${{ github.token }}
preserve-git-dir: true
- key: deploy
use: code
run: ./bin/deploy
- key: sentry-cli
run: |
mkdir -p bin
curl -sL https://sentry.io/get-cli/ | INSTALL_DIR=$PWD/bin bash
echo "$PWD/bin" > $RWX_ENV/PATH
- key: sentry-release
use: [code, sentry-cli]
after: deploy
run: |
export SENTRY_RELEASE=$(sentry-cli releases propose-version)
sentry-cli releases new -p $SENTRY_PROJECT $SENTRY_RELEASE
sentry-cli releases set-commits $SENTRY_RELEASE --auto
sentry-cli releases finalize $SENTRY_RELEASE
sentry-cli deploys new -e $SENTRY_ENVIRONMENT
env:
SENTRY_AUTH_TOKEN: ${{ secrets.sentry-auth-token }}
SENTRY_ORG: your-org-slug
SENTRY_PROJECT: your-project-slug
SENTRY_ENVIRONMENT: production
A few things worth noting:
preserve-git-dir: truekeeps the.gitdirectory sosentry-cli releases set-commits --autocan read commit history.- The
get-cliscript detects the architecture automatically, so the same task works on bothx86_64andarm64base images. - By installing the CLI in a separate task, the installation will be cached and reused across runs.
- RWX automatically merges
$PATHacrossusedependencies, so any task that depends onsentry-clican callsentry-cliby name. See environment variables for details. - Using
afteron thesentry-releasetask means it only runs whendeploysucceeds — you don't want to record a release that didn't actually ship.
Upload source maps
If your application ships source maps, upload them between set-commits and finalize so Sentry can apply them to incoming events:
- key: sentry-release
use: [code, sentry-cli, build]
after: deploy
run: |
export SENTRY_RELEASE=$(sentry-cli releases propose-version)
sentry-cli releases new -p $SENTRY_PROJECT $SENTRY_RELEASE
sentry-cli releases set-commits $SENTRY_RELEASE --auto
sentry-cli sourcemaps upload --release $SENTRY_RELEASE ./dist
sentry-cli releases finalize $SENTRY_RELEASE
sentry-cli deploys new -e $SENTRY_ENVIRONMENT
env:
SENTRY_AUTH_TOKEN: ${{ secrets.sentry-auth-token }}
SENTRY_ORG: your-org-slug
SENTRY_PROJECT: your-project-slug
SENTRY_ENVIRONMENT: production
Replace ./dist with the directory that contains your built assets and source maps.