Coder Social home page Coder Social logo

tclindner / sentry-release-deploy-action Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 7.25 MB

A GitHub action that creates a deploy for a Sentry.io release.

License: MIT License

JavaScript 100.00%
github-action sentry-io sentry-client sentry-cli releases github-releases deployment github-actions

sentry-release-deploy-action's Introduction

sentry-release-deploy-action

license GitHub Actions status

A GitHub action that creates a deploy for a Sentry.io release.

What is sentry-release-deploy-action?

A GitHub action that makes is easy to create a deploy for an existing release in Sentry.io based on events in GitHub. Examples:

  • a GitHub release is published
  • a commit is pushed to master
  • a pull request is merged to master

How does it differ from sentry-releases-action?

sentry-releases-action is used to create a new release, deploy it, associate commits, and finalize a release. sentry-releases-action should be used to create a release. This action is different because it only creates a deploy for an existing release.

How do I use it?

First thing first, let's make sure you have the necessary pre-requisites.

Pre-requisites

Create a workflow .yml file in your repo's .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

version

Required The version being deployed. You can optionally prefix it using versionPrefix.

environment

Required The name of the environment the release was deployed to.

versionPrefix

Optional String that is prefixed to the version to form the Sentry release name.

Please review Sentry's documentation regarding max length and supported characters in release names.

For more information on these inputs, see the API Documentation

Environment Variables

SENTRY_AUTH_TOKEN

Required Sentry auth token.

SENTRY_ORG

Required Sentry organization.

SENTRY_PROJECT

Required Sentry project name.

SENTRY_URL

Optional URL to the Sentry instance, useful for e.g. on-prem deployments.

Example usage

name: Create a deploy for a Sentry.io release
uses: tclindner/[email protected]
env:
  SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  SENTRY_ORG: myAwesomeOrg
  SENTRY_PROJECT: myAwesomeProject
with:
  version: ${{ github.ref }}
  environment: qa

Note: sentry-release-deploy-action will automatically trim refs/tags/ from version if a tag ref is passed. This means you can pass GITHUB_REF directly from release events without the need of mutating it first.

Full example workflow

On every GitHub release event.

name: ReleaseWorkflow

on:
  release:
    types: [published, prereleased]


jobs:
  releaseApp:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@master
      - name: Deploy to dev
        uses: Your action for deployment
      - name: Create a Sentry.io release
        uses: tclindner/[email protected]
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: myAwesomeOrg
          SENTRY_PROJECT: myAwesomeProject
        with:
          tagName: ${{ github.ref }}
          environment: dev
      - name: Run integration tests against dev
        uses: Your action for testing
      - name: Deploy to qa
        uses: Your action for deployment
      - name: Create a deploy for a Sentry.io release
        uses: tclindner/[email protected]
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: myAwesomeOrg
          SENTRY_PROJECT: myAwesomeProject
        with:
          version: ${{ github.ref }}
          environment: qa
      - name: Run integration tests against qa
        uses: Your action for testing

Assume you tagged your release as v1.1.0. github.ref would equal refs/tags/v1.1.0. This action automatically strips refs/tags/, so the Sentry release name is v1.1.0.

Example with optional release prefix

name: Create a deploy for a Sentry.io release
uses: tclindner/[email protected]
env:
  SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  SENTRY_ORG: myAwesomeOrg
  SENTRY_PROJECT: myAwesomeProject
with:
  version: ${{ github.ref }}
  environment: qa
  versionPrefix: myAwesomeProject-

Scenario 1: Assume you tagged your release as v1.1.0. github.ref would equal refs/tags/v1.1.0. This action automatically strips refs/tags/, so the Sentry release name is myAwesomeProject-v1.1.0.

Scenario 2: Assume you tagged your release as 1.1.0 and you set releaseNamePrefix to myAwesomeProject@. github.ref would equal refs/tags/1.1.0. This action automatically strips refs/tags/, so the Sentry release name is [email protected].

Note: This action only works on Linux x86_64 systems.

Related

sentry-releases-action - Action used to create releases. This action should be used first in your CI workflow.

Contributing

Please see CONTRIBUTING.md.

Release History

Please see CHANGELOG.md.

License

Copyright (c) 2020-2023 Thomas Lindner. Licensed under the MIT license.

sentry-release-deploy-action's People

Contributors

dependabot[bot] avatar tclindner avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

kazimevi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.