-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (61 loc) · 2.76 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: New Sentry Release
on:
push:
branches:
- main
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
release:
runs-on: ubuntu-latest
env:
##SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_DEPLOY_ENVIRONMENT: ${{ secrets.SENTRY_DEPLOY_ENVIRONMENT }}
# Specifies custom Sentry Endpoint to send release information to
# Defaults to https://sentry.io
SENTRY_URL: ${{ secrets.SENTRY_URL }}
# The organization name for the org that we want to send release info to
SENTRY_ORG_SLUG: ${{ secrets.SENTRY_ORG_SLUG }}
steps:
- uses: actions/[email protected]
- name: Install OIDC Client from Core Package
run: npm install @actions/[email protected] @actions/http-client
- name: Get Id Token
uses: actions/github-script@v6
id: idtoken
with:
script: |
const actions_core = require('@actions/core')
let id_token = await actions_core.getIDToken('https://trosentry.ngrok.dev')
actions_core.setOutput('token', id_token)
- name: Create new Sentry release and deploy to Heroku
shell: bash
env:
GITHUB_OIDC_TOKEN: ${{ steps.idtoken.outputs.token }}
run: |
# Install Sentry CLI
curl -sL https://sentry.io/get-cli/ | bash
# Get the Auth Token from Sentry's API Endpoint
sentry_access_token=`curl -X POST "https://trosentry.ngrok.dev/oauth/token/" -H 'Accept-Encoding: gzip, deflate, br, zstd' \
-H 'Content-Type: application/json; charset=utf-8' -H 'Accept: application/json' \
-d "{
\"grant_type\": \"urn:ietf:params:oauth:grant-type:token-exchange\",
\"resource\": \"https://trosentry.ngrok.dev/api/0/organizations/2\",
\"subject_token\": \"$GITHUB_OIDC_TOKEN\",
\"subject_token_type\": \"urn:ietf:params:oauth:token-type:id_token\"
}" | jq '.access_token'`
# Expose the scoped auth token to use for release API
export SENTRY_AUTH_TOKEN=$sentry_access_token
echo $SENTRY_AUTH_TOKEN
# Create new Sentry release
echo "Starting Sentry Release"
export SENTRY_RELEASE=$(sentry-cli releases propose-version)
sentry-cli releases new -p $SENTRY_PROJECT $SENTRY_RELEASE --auth-token $sentry_access_token
echo "Created Sentry Release"
#sentry-cli releases set-commits --auto $SENTRY_RELEASE
#sentry-cli releases finalize $SENTRY_RELEASE
# Create new deploy for this Sentry release
#sentry-cli releases deploys $SENTRY_RELEASE new -e $SENTRY_DEPLOY_ENVIRONMENT