getsentry / action-release Goto Github PK
View Code? Open in Web Editor NEWGitHub Action for creating a release on Sentry
License: Apache License 2.0
GitHub Action for creating a release on Sentry
License: Apache License 2.0
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
TypeScript 4
name: Sentry release
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: exampleorg
SENTRY_PROJECT: myproject
with:
environment: production
version: ${{ steps.get_version.outputs.VERSION }}
Release is created on sentry.
This snippet is working fine.
- name: Create Sentry release
run: |
sentry-cli info 2>&1 || curl -sL https://sentry.io/get-cli/ | bash
sentry-cli releases new "$VERSION"
sentry-cli releases files "$VERSION" upload-sourcemaps dist
rm dist/*.map
sentry-cli releases finalize "$VERSION"
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: exampleorg
SENTRY_PROJECT: myproject
VERSION: ${{ steps.get_version.outputs.VERSION }}
Run getsentry/action-release@v1
/usr/bin/docker run --name sentryintegrationssentrygithubactionreleaselatest_e4dc8a --label c3f261 --workdir /github/workspace --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -e SENTRY_PROJECT -e INPUT_ENVIRONMENT -e INPUT_VERSION -e INPUT_SOURCEMAPS -e INPUT_FINALIZE -e INPUT_STARTED_AT -e INPUT_VERSION_PREFIX -e INPUT_SET_COMMITS -e INPUT_PROJECTS -e INPUT_URL_PREFIX -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/tmp/github-runner/_temp/_github_home":"/github/home" -v "/tmp/github-runner/_temp/_github_workflow":"/github/workflow" -v "/tmp/github-runner/_temp/_runner_file_commands":"/github/file_commands" -v "/tmp/github-runner/example.org/example.org":"/github/workspace" sentryintegrations/sentry-github-action-release:latest
Error: Command failed: /action-release/dist/sentry-cli releases set-commits master --auto
error: could not find repository from '.'; class=Repository (6); code=NotFound (-3)
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.
How do you use Sentry?
Self-hosted/on-premise / Version Sentry 21.8.0.dev0 0664dd8
Source maps are uploaded successful.
error: ./www: IO error for operation on ./www: No such file or directory (os error 2)
This is a preview of my action.
- name: List files
run: ls -al ./www
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
with:
environment: dev
sourcemaps: ./www
set_commits: skip
The list is successful.
total 16840
drwxr-xr-x 4 root root 12288 Sep 13 20:59 .
drwxr-xr-x 12 root root 4096 Sep 13 20:59 ..
-rw-r--r-- 1 root root 461 Sep 13 20:59 1006.73dc42eae00d4b7873dd.js
-rw-r--r-- 1 root root 1116 Sep 13 20:59 1006.73dc42eae00d4b7873dd.js.map
-rw-r--r-- 1 root root 15050 Sep 13 20:59 123.f318719ca66193f8dc29.js
-rw-r--r-- 1 root root 24887 Sep 13 20:59 123.f318719ca66193f8dc29.js.map
-rw-r--r-- 1 root root 2022 Sep 13 20:59 1535.ed490ee0f20f85053cf6.js
-rw-r--r-- 1 root root 8107 Sep 13 20:59 1535.ed490ee0f20f85053cf6.js.map
-rw-r--r-- 1 root root 76692 Sep 13 20:59 2099.c7e6f2de2efc6764b1eb.js
-rw-r--r-- 1 root root 94027 Sep 13 20:59 2099.c7e6f2de2efc6764b1eb.js.map
-rw-r--r-- 1 root root 1324 Sep 13 20:59 2177.df02d406d5e9573ad358.js
-rw-r--r-- 1 root root 6152 Sep 13 20:59 2177.df02d406d5e9573ad358.js.map
-rw-r--r-- 1 root root 6036 Sep 13 20:59 2178.80f553e271e82f3f52d6.js
-rw-r--r-- 1 root root 14983 Sep 13 20:59 2178.80f553e271e82f3f52d6.js.map
So I have many source map files.
Then this action has an error.
error: ./www: IO error for operation on ./www: No such file or directory (os error 2)
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.
When I do the same on local CLI by myself it work's fine.
$ sentry-cli releases files 1.0.0 upload-sourcemaps ./www
> Found 141 release files
> Analyzing 141 sources
> Analyzing completed in 0.278s
> Rewriting sources
> Rewriting completed in 0.322s
> Adding source map references
> Bundling files for upload... ~/4806.b179e5a749e25a15c565.js
> Bundling completed in 0.376s
> Optimizing completed in 0.009s
> Uploading completed in 0.803s
> Uploaded release files to Sentry
> Processing completed in 0.05s
> File upload complete (processing pending on server)
I am using Sentry Saas
This error comes from the github action
I have setup the action as follows:
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: $ENVIRONMENT
sourcemaps: ./build
version: ${{ env.REACT_APP_BUILD_NUMBER }}
set_commits: auto
I then get the error:
Command failed: /action-release/dist/sentry-cli releases set-commits 2.5 --auto
2.5
is the value of REACT_APP_BUILD_NUMBER in this run,
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
N/A
- name: Sentry Release
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: HIDDEN
SENTRY_PROJECT: HIDDEN
with:
environment: prod
sourcemaps: dist
set_commits: skip
Successfully create a new release to Sentry and upload the source maps.
Pass URL to sentry-cli using the action, to support on-premise instances of Sentry.
The Sentry cli is supporting the option.
$ sentry-cli --help
sentry-cli 1.70.1
Command line utility for Sentry.
This tool helps you manage remote resources on a Sentry server like
sourcemaps, debug symbols or releases. Use `--help` on the subcommands
to learn more about them.
USAGE:
sentry-cli <SUBCOMMAND>
OPTIONS:
......
--url <URL>
Fully qualified URL to the Sentry server.
[defaults to https://sentry.io/]
......
It's unclear to me if it is possible to connect this workflow to a on-premise version of Sentry or not.
If so, how/where do I declare the URL?
Thanks!
Currently, It's possible to optionally add a single environment.
- uses: actions/checkout@v2
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
. . .
with:
environment: production #<<<
It would be great to be able to add multiple environments for example:
with:
environments: [production, staging]
Or:
with:
environments:
- production
- staging
- ...
The only way to achieve this kind of behavior now is to have it all twice, which is a pain. Especially if you want to be specific.
I think it would be great to show more samples of how to transition from the cli usage over to the action usage.
Especially the use case where you open a release and finalize it.
run: |
export SENTRY_RELEASE=$(sentry-cli releases propose-version)
sentry-cli releases new -p $SENTRY_PROJECT $SENTRY_RELEASE
sentry-cli releases set-commits --auto $SENTRY_RELEASE
echo "::set-env name=SENTRY_RELEASE::$SENTRY_RELEASE"
and
- name: Sentry deploy
run: |
sentry-cli releases finalize $SENTRY_RELEASE
sentry-cli releases deploys $SENTRY_RELEASE new -e $SENTRY_DEPLOY_ENVIRONMENT
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
getsentry/[email protected]
steps:
- uses: actions/checkout@v3
name: ๐ฌ - Checkout EMG API
with:
repository: 'someuser/somerepo'
ref: 'abranch'
path: 'a-subdir'
- name: Sentry Release
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: 'an-env'
sourcemaps: './a-subdir/dist/js'
The version should be taken from the commit SHA.
The action step fails:
Error: Command failed: /action-release/dist/sentry-cli releases propose-version
[28](https://github.com/<someuser>/<somerepo>/runs/<runid>?check_suite_focus=true#step:21:28)
error: Could not automatically determine release name
This is because the action does NOT use the GitHub SHA directly, but calls the CLI's proposeVersion
, which seemingly needs to be run with the working-dir as the repository.
Add with: version: ${{ github.sha }}
to the Sentry Release action.
The manual version label is then used and action should succeed.
Action step fails:
INFO 2022-04-12 08:27:21.419745496 +00:00 Resolving HEAD (<someuser>/<somerepo>@HEAD)
error: could not find repository from '.'; class=Repository (6); code=NotFound (-3)
I was hoping to use this to push new releases mainly for suspected commits.
Once I make a build, I'll be promoting the same artifacts throughout different environments (stg/prod).
The docs state the environment, why is that the case? And would it be possible to make it optional?
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
n/a
Used this GitHub action.
Release would be reported and my workflow would complete successfully.
My workflow failed with:
Error: Command failed: /action-release/dist/sentry-cli releases set-commits a5a6307641da6a013acad34cc4e277435d206489 --auto
error: API request failed
caused by: sentry reported an error: unknown error (http status: 503)
I'm trying to create a Sentry.io release using the Github action and keep running into the error below:
Warning: Unexpected input(s) 'url_prefix', valid inputs are ['entryPoint', 'args', 'environment', 'sourcemaps', 'finalize', 'started_at', 'version', 'version_prefix', 'set_commits', 'projects']
Run getsentry/action-release@v1
/usr/bin/docker run --name sentryintegrationssentrygithubactionreleaselatest_d37d34 --label 179394 --workdir /github/workspace --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -e SENTRY_PROJECT -e INPUT_ENVIRONMENT -e INPUT_SOURCEMAPS -e INPUT_URL_PREFIX -e INPUT_FINALIZE -e INPUT_STARTED_AT -e INPUT_VERSION -e INPUT_VERSION_PREFIX -e INPUT_SET_COMMITS -e INPUT_PROJECTS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/oneasics-portal/oneasics-portal":"/github/workspace" sentryintegrations/sentry-github-action-release:latest
The relevant part of my yaml file:
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: 'dev2'
set_commits: 'skip'
sourcemaps: './build/static/js'
url_prefix: '~/console/static/js'
Should I be using entryPoint
instead of url_prefix
?
Hi thanks for publishing this action, very handy! I'm getting the following error in one of my repositories (private).
usr/bin/docker run --name sentryintegrationssentrygithubactionreleaselatest_b8842c --label 87c201 --workdir /github/workspace --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -e SENTRY_PROJECT -e INPUT_ENVIRONMENT -e INPUT_SOURCEMAPS -e INPUT_VERSION -e INPUT_FINALIZE -e INPUT_STARTED_AT -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/redacted/redacted":"/github/workspace" sentryintegrations/sentry-github-action-release:latest
##[error]Command failed: /action-release/dist/sentry-cli releases set-commits 3.57.0 --auto
error: No commits found. Leaving release alone.
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.
Here is the simplified yaml:
name: Tag release
on:
push:
branches: [master]
tags:
- '!v*'
jobs:
tag_release:
name: Tag release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create Sentry release
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: REDACTED
SENTRY_PROJECT: REDACTED
with:
environment: production
sourcemaps: '${{ env.GITHUB_WORKSPACE }}/app'
version: 3.57.0
The getVersion()
function prematurely returns when the version option is set.
So, something like this ignores the prefix option
- name: Create Sentry Release
uses: getsentry/action-release@v1
with:
environment: prod
version_prefix: app-name@
version: ${{ env.IMAGE_TAG }}
You can see the action released in here.
Checklist for a new release:
package.json
and merge itThe documentation and examples all have this line in the workflow:
uses: getsentry/action-release@v1
Using this generates the following error for me every time:
An action could not be found at the URI 'https://api.github.com/repos/getsentry/action-release/tarball/v1'
Changing it to @master
or @e36b15df9c918bb4f976e36893d08d35538daa59
(or some other specific commit) works, but I can't get it to work using the syntax from the documentation.
I have a case that in the staging environment we are not using the tags but a release-candidate branch, so I'm expecting to have a release candidate branch name as the version.
I noticed that only the refs/tags/
is stripped, so when setting version
with ${{ github.ref }}
it complains the slashes are not permitted.
I'm wondering if we can enhance the following regex process to allow strip the prefix for refs/heads as well?
Lines 14 to 15 in 62ef65f
I'm using semantic-release to create new tags/releases.
Semantic-Release uses the GITHUB_TOKEN to draft a new release, and according to GitHub, those actions do not trigger an event on GitHub Actions (such as on: release
). The alternative is to trigger a workflow after semantic-release is done:
name: Sentry Release
on:
workflow_run:
workflows:
- 'Semantic Release'
branches:
- main
types:
- completed
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
id: release
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const release = await github.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
});
return release.name;
result-encoding: string
- name: Create Sentry release
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_LOG_LEVEL: debug
with:
environment: production
version: ${{steps.release.outputs.result}}
Unexpected input(s) 'version', valid inputs are ['entryPoint', 'args', 'environment', 'sourcemaps', 'finalize', 'started_at']
Version is a parameter according to the readme.
Second, something is wrong with the repositories:
DEBUG 2020-09-28 21:15:33.868807990 +00:00 < Link: <https://sentry.io/api/0/organizations/***/repos/?&cursor=100:-1:1>; rel="previous"; results="false"; cursor="100:-1:1", <https://sentry.io/api/0/organizations/***/repos/?&cursor=100:1:0>; rel="next"; results="false"; cursor="100:1:0"
...
DEBUG 2020-09-28 21:15:33.868871489 +00:00 response status: 200
DEBUG 2020-09-28 21:15:33.869251286 +00:00 body: [{
"status": "active",
"integrationId": "",
"externalSlug": "***/api",
"name": "***/api",
"provider": {
"id": "integrations:github",
"name": "GitHub"
},
"url": "https://github.com/***/api"
}, {
"status": "active",
"integrationId": "",
"externalSlug": "***/***",
"name": "***/***",
"provider": {
"id": "integrations:github",
"name": "GitHub"
},
"url": "https://github.com/***/***"
}]
INFO 2020-09-28 21:15:33.869439585 +00:00 Resolving HEAD (***/api@HEAD)
DEBUG 2020-09-28 21:15:33.869525384 +00:00 error: running update nagger
DEBUG 2020-09-28 21:15:33.869536184 +00:00 skipping update nagger because session is not attended
error: could not find repository from '.'; class=Repository (6); code=NotFound (-3)
The first thing that I see is that the repo is wrong (Resolving HEAD (***/api@HEAD)
, while the repo name is web
) and then obviously error: could not find repository from '.'
.
Not exactly sure what's going on? The secrets are all correct and I checked the requests in curl, the results are correct too.
It would be great to be able to use the latest version of @sentry/cli !
https://github.com/marketplace/actions/sentry-release#examples
The given example is wrong:
- uses: getsentry/action-release@v1
with:
environment: 'production'
version: 'v1.0.1'
Version is set to 'v1.0.1'
Warning: Unexpected input(s) 'version', valid inputs are ['entryPoint', 'args', 'environment', 'sourcemaps', 'finalize', 'started_at']
Hi.
As per https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/, the set-command
output has been deprecated, which results in the following warning being issued whenever the action is used:
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
The warning should go away by bumping @actions/core
package to 1.10.0
or higher.
Update to the latest sentry-cli version:
Latest 2.x
Current 1.67.2 (Released almost three years ago)
We should add some kind of CHANGELOG. Makes it easier for users of the action to understand what fixes/features have happened. Also provides us a way to introduce + document breaking changes.
I have a workflow on github actions that publishes several modules from a repository
(monorepo)
it would be interesting if I could release the multiple modules (which are projects in sentry) in one step
via SENTRY_PROJECT
accepting multiple args
something like this
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_PROJECT: orodruin-worker orodruin-server
with:
environment: production
version: ${{ needs.changelog.outputs.ref }}
- name: Send Release To Sentry
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: "xxx"
SENTRY_ORG: "xxx"
SENTRY_PROJECT: "xxx"
SENTRY_URL: "xxx"
with:
environment: "production"
sourcemaps: "./dist/assets"
version: ${{ github.sha }}
set_commits: "skip"
url_prefix: "~/sentry-config-test/assets"
i hope i can upload sourcemap successful!!!
The version
parameter of this action is actually the release
field in the Sentry init config. This naming mismatch is confusing and particularly interesting since https://docs.sentry.io/platforms/javascript/#configure suggests prefixing your releases with a projectname. If the names are inconsistent, the releases will not work properly and debugging is kind of hard due to the behavior of releases in Sentry (shown below). The appropriate naming is non-obvious from the documentation and slightly weird for a version
parameter.
The releases tab seems to auto-generate releases for incoming errors, so it will show both versions making it appear the correct one was created.
However diving into a project's source maps (that page is kind of hidden) will show the versions twice, one without source maps (as also apparent in errors if your server is blocking HTTP access to sourcemaps):
Only the tooltip will reveal the true release name (the other has no prefix):
I would suggest adding a release
or release-name
parameter and deprecating version
or hiding it in the docs for clarity.
So I forked the project yesterday to add some missing parameters and I ran yarn run all
to make sure my cloned copy before starting was passing tests, etc.
The command failed.
โ action-release git:(master) yarn run all
yarn run v1.22.17
$ yarn run format && yarn run lint && yarn run build && yarn test
$ prettier --write **/*.ts
__tests__/main.test.ts 130ms
src/cli.ts 14ms
src/main.ts 10ms
src/options.ts 18ms
$ eslint src/**/*.ts
/Volumes/Nexus/Github/action-release/src/cli.ts
1:20 error 'SentryCliReleases' is defined but never used @typescript-eslint/no-unused-vars
โ 1 problem (1 error, 0 warnings)
So then I wondered how PRs were getting merged. They don't seem to be running lints or tests at all. The test
workflow just runs the action itself in MOCK mode. Was it an oversight that no CI workflow actually runs and enforces Linting/Testing?
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
gem "sentry-rails", "4.3.2"
gem "sentry-ruby", "4.3.1"
name: Build
on:
push:
branches: [main]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
- name: Notify Sentry of Build
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: nulogy
SENTRY_PROJECT: opscore
with:
version_prefix: opscore@
main
No warnings
Warning message in the GitHub Action:
The version prefix seems to be getting through though because I see it in the Releases page in Sentry:
It would be useful if commits could be set based on the previous release for the given environment, instead of the latest release.
That would allow to have granular / more correct assignments of commits for a testing/staging/production workflow, where releases to testing (e.g. deployed when merging into the master/main branch) would have a small number of commits, whereas the set of commits for a (pre-)release to staging then is bigger (but includes all the ones from testing being released to staging only now), and production typically has the same set of commits as the release to staging then.
Currently it appears to be that the creation of the release for testing assigns a small set of commits to the release, and then the same set (typically only one from a merged PR) is used for the later release to staging/production.
I've only found out just now that environment
is optional with the GitHub Action (#19, #36), and will trigger a deployment, which might have interfered with / caused the behavior I am seeing/describing above. So I'll test it without specifying the environment, but suspect the issue might persist, given the docs that say:
If you also want to set a previous commit instead of letting the server use the previous release as the base point you can do that by setting a commit range
(Assuming that a new set_commits: prev_env
setting might make sense, I'd probably still like not having created a deployment automatically if environment
is provided, so this would maybe have to be controlled through a separate setting then)
Currently, almost any code landing on master
will produce a new Docker image tagged as latest
which all users of the action will immediately start using.
We need to have control as to when releases happen.
We should only release on tag changes as suggested by @asottile-sentry
As you can see, the commits below are not code changing, thus, it should not produce a new image
As a side note, to my surprise, the caching gets invalidated with COPY package.json yarn.lock /action-release :
https://github.com/getsentry/action-release/runs/7567494647?check_suite_focus=true#step:4:51
Before, we used to copy it from the builder image.
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
React 6.2.1
The build was pushed to the sentry site.
I'm not sure if this is the right place to report this, or if this is just a general actions bug. When the action ran, it produced the following error:
Environment variable SENTRY_AUTH_TOKEN is missing an auth token
I checked, double-checked, and triple-checked, and the token is definitely set. The check even passes and fails at random, with the same error, and no changes to the environment. Rerunning the check seems to make it pass, but not always.
The relevant portion of the logs is:
2021-03-10T16:42:09.1911230Z ##[group]Run getsentry/[email protected]
2021-03-15T07:16:43.4645475Z with:
2021-03-15T07:16:43.4645881Z environment: deploy-preview
2021-03-15T07:16:43.4646317Z sourcemaps: ./build/
2021-03-15T07:16:43.4646907Z version: 83e3c0f96eed086fd37d86a7dc6accf9caf88e9c
2021-03-15T07:16:43.4647539Z version_prefix: forms-frontend@
2021-03-15T07:16:43.4647961Z finalize: true
2021-03-15T07:16:43.4648263Z env:
2021-03-15T07:16:43.4648584Z SENTRY_AUTH_TOKEN:
2021-03-15T07:16:43.4648977Z SENTRY_ORG: python-discord
2021-03-15T07:16:43.4649444Z SENTRY_PROJECT: forms-frontend
2021-03-10T16:42:09.1915408Z ##[endgroup]
2021-03-10T16:42:09.1950772Z ##[command]/usr/bin/docker run --name sentryintegrationssentrygithubactionreleaselatest_3c90fc --label 5588e4 --workdir /github/workspace --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -e SENTRY_PROJECT -e INPUT_ENVIRONMENT -e INPUT_SOURCEMAPS -e INPUT_VERSION -e INPUT_VERSION_PREFIX -e INPUT_FINALIZE -e INPUT_STARTED_AT -e INPUT_SET_COMMITS -e INPUT_PROJECTS -e INPUT_URL_PREFIX -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/forms-frontend/forms-frontend":"/github/workspace" sentryintegrations/sentry-github-action-release:latest
2021-03-10T16:42:10.6436287Z ##[error]Environment variable SENTRY_AUTH_TOKEN is missing an auth token
I can't link to a specific section of the raw logs, but it is towards the very bottom of the link.
The workflow config is available here:
https://github.com/python-discord/forms-frontend/actions/runs/653317602/workflow
I can provide more info as needed.
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
getsentry/action-release@v1
I've followed the intructions to configure getsentry/action-release
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
Release should be created in sentry.io and the related commits should be shown, i.e. the list of new commits, not included in the previous release.
You can see the action released in here.
Checklist for a new release:
package.json
and merge itI'm building a sourcemap with esbuild but somehow end up with a files referenced as /../../../src/config.ts
. So quickest solution to fix this seems to be the --strip-common-prefix
(which is for my case /../../../
When I used the following:
sentry_release:
name: Create Sentry release
needs: [ test_js, test_py ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ env.ORG }}
SENTRY_PROJECT: ${{ env.SENTRY_PROJECT }}
with:
environment: prod
I got the following error:
error: Could not find the SHA of the previous release in the git history. Increase your git clone depth.
It wasn't clear obvious what to do right away, so I'm wondering if, in the documentation/README, it would be better to change the checkout step to following and add a note about why it's necessary.
- uses: actions/checkout@v2
with:
fetch-depth: 0
This is what solved it for me. I also wasn't sure if I should use something other than zero because in Github's docs it's not clear what other numbers do.
I'm happy to make a PR for the README if this sounds good or please go ahead and just change it if you want.
Thank you!
Hi!
We currently upload our sourcemaps in a post-deploy CLI task, but need the url-prefix
option to get our sourcemaps pointing at the proper location. It looks like it would require passing in url-prefix
as an option here: https://github.com/getsentry/action-release/blob/master/src/main.ts#L29
Hi, when I use this action on Production, there is a warning from this module.
The warning from Github is:
Unexpected input(s) 'version', valid inputs are ['entryPoint', 'args', 'environment', 'sourcemaps', 'finalize', 'started_at']
I believe it is because of the version
input from the yml file.
My yml file is
# master.yml
...
- uses: getsentry/[email protected]
with:
environment: production
sourcemaps: './dist'
version: 1.1.1
The release recorded from Sentry is correct and reflect the correct version from the yml file so It is not a big issue.
My build is minified, and I need to decompress using the CLI:
releases files v0.0.1 upload-sourcemaps --decompress build
name: Create Sentry release
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
sourcemaps: "./build"
version: "${{ env.VERSION }}"
+ decompress: true
Thanks!
It would be better if the source maps option would accept an array. Instead of:
sourcemaps: ./dist/bar ./out/bar
it would be:
sourcemaps:
- ./dist/bar
- ./out/bar
Looks like currently it's impossible to set the --ext
argument of the CLI, this is important when using TypeScript.
Hello! I'm porting over my team's react native build pipeline from CircleCI to Github Actions and just discovered that this action is only supported on Linux containers.
As a workaround, we're going to have to install sentry-cli
and run the release command manually. It would be great to have this action work on macos
as well!
How do you use Sentry?
Sentry SaaS
You can check the project and the error here:
https://github.com/cesarvarela/stahp/runs/3249265240?check_suite_focus=true
It seems like the CLI in the Sentry Action release is stuck to 1.59, while 1.65 supports the ignore missing
commit flag.
Getting this error, on premise without the github integration.
using personal access token for SENTRY_AUTH_TOKEN. It works from local sentry-cli
Error: Command failed: /action-release/dist/sentry-cli releases set-commits 03e3472 --auto
error: No repositories are configured in Sentry for your organization.
So an option to skip it or to set --local instead
I am also running into this #51
The scope of my token is project:releases
, maybe that is not enough. I can suggest two improvements
These docs (https://docs.sentry.io/api/releases/create-a-new-release-for-an-organization/) mention that project:releases
scope should be enough, but apparently it doesn't work. Still looking into it.
If the action starts failing we should track the errors.
I'm using the Sentry Release action to create a release of my React Native app and part of that is uploading sourcemaps. Here's how I'm doing it:
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
VERSION_CODE: ${{ steps.get_version.outputs.VERSION_CODE }}
VERSION_NAME: ${{ steps.get_version.outputs.VERSION_NAME }}
with:
environment: production
version: com.a494studios.koreanconjugator@${{ env.VERSION_NAME }}+${{ env.VERSION_CODE }}
url_prefix: app:///
sourcemaps: android/app/build/generated/assets/react/release/index.android.bundle android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
The problem is that the sourcemaps aren't working correctly because they're not being assigned a dist
value. With the CLI I would use the --dist
flag, but I don't see an option for that in the docs or in the source code. Is there any interest in adding a dist
option to this action? I could probably make a PR to add that change in if it's desired.
Hello,
is it possible to set custom URL for on-perm instances of Sentry or this action will always connect to sentry.io?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.