Last active
May 3, 2022 12:35
-
-
Save dougwaldron/0c2c9abcefb86b0426efc8583598bd8f to your computer and use it in GitHub Desktop.
GitHub action to automatically add a new deployment to Raygun's deployment tracking tools based on tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow to register a new application deployment with Raygun. | |
# The workflow is triggered when a tag with the specified prefix is pushed to | |
# GitHub. The tag should be formatted as a prefix followed by the version | |
# number. For example: "prod/1.0.0" | |
# | |
# To use this workflow, you must: | |
# | |
# 1. Make sure the tag prefix is set correctly below. The default is "prod/". | |
# | |
# 2. Add two "Action secrets" in the GitHub repository settings: | |
# | |
# * RAYGUN_APIKEY = the API key for the Raygun project | |
# * RAYGUN_AUTHTOKEN = an "External Access Token" for your user account | |
# (generated at https://app.raygun.com/user) | |
# | |
# Learn more about Raygun Deployment Tracking at: | |
# https://raygun.com/documentation/product-guides/deployment-tracking/overview/ | |
name: Raygun Deployment Tracking | |
on: | |
push: | |
# Update this line with the desired tag prefix, e.g., "prod/*" | |
tags: prod/* | |
jobs: | |
raygun-deployment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get the version number | |
id: get_version | |
run: echo ::set-output name=version::${GITHUB_REF##*/} | |
- name: Send to the Raygun Deployments API | |
id: send_deployment | |
uses: fjogeleit/http-request-action@master | |
with: | |
url: https://app.raygun.com/deployments?authToken=${{ secrets.RAYGUN_AUTHTOKEN }} | |
method: POST | |
data: >- | |
{ | |
"apiKey": "${{ secrets.RAYGUN_APIKEY }}", | |
"version": "${{ steps.get_version.outputs.version }}", | |
"ownerName": "${{ github.event.pusher.name }}", | |
"emailAddress": "${{ github.event.pusher.email }}", | |
"scmIdentifier": "${{ github.sha }}" | |
} | |
- name: Show response | |
run: echo ${{ steps.send_deployment.outputs.response }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment