Back to Blog Home

Automate Release Management with the Sentry Release GitHub Action

Marcos Gaeta image

Marcos Gaeta -

Automate Release Management with the Sentry Release GitHub Action

Time trolls people. It speeds up in good times and slows down in bad. For instance, when you push code, your brain feels like it’s in a whirlwind. But when you’re debugging subsequent errors, the hours seem to slog by. This is particularly true if you are operating without context and without the help of automation. Fortunately, our friends at GitHub built an automation platform for products like Sentry to integrate with: Sentry Release GitHub Action.

Manual Is Maddening

When deploying code to an environment, it’s a manual process to note a release in Sentry, configure suspect commits, and upload source maps (if you’re using JavaScript).

It’s 2020, so there’s no need for us to be jumping through these hoops. So we built the Sentry Release GitHub Action to automate all of that. Follow the steps below and you’ll be able to automatically notify Sentry of new releases, surface suspect commits in the event you encounter a post-deploy error, and view un-minified JavaScript.

Install the Action

Get started by creating a YAML file .github/workflows/<NAME>.yml in the root of your GitHub repository with the following code.

name: Deploy on: push: branches: [ master ] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Sentry Release uses: getsentry/action-release@v1.0.0 env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_ORG: ${{ secrets.SENTRY_ORG }} SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} with: environment: production

Any name should work, so I chose deploy.yml. If you already have a workflow, then just add this block:

- name: Sentry Release uses: getsentry/action-release@v1.0.0 env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_ORG: ${{ secrets.SENTRY_ORG }} SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} with: environment: production

One important thing to remember is setting up Sentry’s environment variables. Start by setting up a GitHub Secret for your SENTRY_AUTH_TOKEN. Creating a Sentry auth token is explained in this guide. You may want to keep the names of your organization and project to yourself. If you're working on a Javascript project, you can vastly improve your error stack traces by including source maps. Just add the source map paths as a space-separated list to the source maps parameter.

- name: Sentry Release uses: getsentry/action-release@v1.0.0 with: environment: production sourcemaps: ./lib

Once the steps complete, the green check mark lets us know that we've successfully deployed.

Next, head to Sentry and click on Releases. You’ll see the Action took care of the heavy lifting.

We hope that the Sentry Release GitHub Action helps you defy these pesky time trolls, shave some time off managing new releases, and most important, surface the information you need to quickly resolve errors.

Share

Share on Twitter
Share on Facebook
Share on HackerNews
Share on LinkedIn

Published

Sentry Sign Up CTA

Code breaks, fix it faster

Sign up for Sentry and monitor your application in minutes.

Try Sentry Free

Topics

Ecosystem

The best way to debug slow web pages

Listen to the Syntax Podcast

Of course we sponsor a developer podcast. Check it out on your favorite listening platform.

Listen To Syntax
    TwitterGitHubDribbbleLinkedinDiscord
© 2024 • Sentry is a registered Trademark of Functional Software, Inc.