Skip to content

Commit 37231de

Browse files
authored
Merge pull request #1 from mathrix-education/dev
chore(release): release 0.1.0
2 parents 9d72152 + dfa9f19 commit 37231de

15 files changed

Lines changed: 1177 additions & 0 deletions

File tree

.github/workflows/tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Tests
2+
on: push
3+
jobs:
4+
test:
5+
strategy:
6+
matrix:
7+
os: [ubuntu-latest, macos-latest, windows-latest]
8+
version: [latest, 1.49.0]
9+
fail-fast: false
10+
runs-on: ${{ matrix.os }}
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v1
14+
- name: Setup Node.js 12
15+
uses: actions/setup-node@v1.2.0
16+
with:
17+
node-version: 12.x
18+
- name: Install Sentry CLI
19+
run: node dist/index.js
20+
env:
21+
INPUT_VERSION: ${{ matrix.version }}
22+
INPUT_URL: ${{ secrets.SENTRY_URL }}
23+
INPUT_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
24+
INPUT_ORGANIZATION: ${{ secrets.SENTRY_ORGANIZATION }}
25+
INPUT_PROJECT: ${{ secrets.SENTRY_PROJECT }}
26+
- name: Display Sentry CLI info
27+
run: |
28+
sentry-cli --help
29+
sentry-cli info
30+
- name: Make release
31+
if: contains(matrix.os, 'ubuntu') && matrix.version == 'latest' # do not duplicate releases
32+
run: |
33+
VERSION=`sentry-cli releases propose-version`
34+
sentry-cli releases new "$VERSION"
35+
sentry-cli releases set-commits "$VERSION" --auto
36+
sentry-cli releases files "$VERSION" upload-sourcemaps ./dist \
37+
--rewrite \
38+
--ext map \
39+
--validate \
40+
--verbose \
41+
--strip-common-prefix
42+
sentry-cli releases finalize "$VERSION"
43+
- name: Send test event
44+
if: contains(matrix.os, 'ubuntu') && matrix.version == 'latest' # do not duplicate events
45+
run: |
46+
export SENTRY_DSN=${{ secrets.SENTRY_DSN }}
47+
sentry-cli send-event -m "Hello from GitHub Actions"
48+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea/
2+
node_modules/

.huskyrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const tasks = commands => commands.join(' && ');
2+
3+
module.exports = {
4+
hooks: {
5+
'pre-commit': tasks(['npm run build', 'git add dist/']),
6+
},
7+
};

README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# mathrix-education/setup-sentry-cli
2+
Install the Sentry CLI in your GitHub Actions workflow.
3+
4+
**This action is not supported by Sentry.**
5+
6+
Proudly maintained by [Mathieu Bour][1.1], Vice-CTO
7+
[@mathrix-education][1.2].
8+
9+
[1.1]: https://github.com/mathieu-bour
10+
[1.2]: https://github.com/mathrix-education
11+
12+
## Motivations
13+
Installing Sentry CLI in GitHub Actions can be relevant in many cases.
14+
Mathrix Education SA is based on Angular, which produces sourcemaps.
15+
Therefore, we need to upload sourcemaps, during our compilation
16+
workflow.
17+
18+
There is an
19+
[official guide to use sentry-cli on the Sentry's blog][2.1],
20+
but it requires to use a bunch of commands, which is not really
21+
straight forward.
22+
23+
There are also some [Docker-based actions][2.2], but they are quite
24+
slow.
25+
26+
[2.1]: https://blog.sentry.io/2019/12/17/using-github-actions-to-create-sentry-releases
27+
[2.2]: https://github.com/marketplace?type=actions&query=sentry
28+
29+
30+
## Usage
31+
### Supported operating systems
32+
This action currently supports Ubuntu, Windows and Mac-OS based systems.
33+
The supported operating systems matrix is the following:
34+
35+
| Operating system | Status |
36+
|------------------|-------|
37+
| `ubuntu-latest` | ![3.1] |
38+
| `macos-latest` | ![3.1] |
39+
| `windows-latest` | ![3.1] |
40+
41+
[3.1]: https://img.shields.io/badge/status-supported-brightgreen
42+
43+
### Inputs
44+
| Name | Type | Default value |
45+
|----------------|-----------------------|---------------|
46+
| `version` | `'latest'` / `string` | `'latest'` |
47+
| `token` | `string` | `''` |
48+
| `url` | `string` | `''` |
49+
| `organization` | `string` | `''` |
50+
| `project` | `string` | `''` |
51+
52+
See [action.yml](action.yml) for details.
53+
54+
#### `version`
55+
If you need a precise version of the Sentry CLI, you may provide this
56+
input. We strongly advise you to do so since using the latest version
57+
may break your workflow if Sentry releases a backward-incompatible
58+
version.
59+
60+
#### `url`
61+
The Sentry server URL. By default, this action will configure the
62+
Sentry CLI to interact with official Sentry server which is
63+
`https://sentry.io`. If you use an on-premise instance, you may provide
64+
your server URL here.
65+
66+
#### `token`
67+
This is the token which will be used by the Sentry CLI to authenticate
68+
against the Sentry server.
69+
You may generate it on your personal account page.
70+
71+
#### `organization`
72+
Define the default organization.
73+
74+
#### `project`
75+
Define the default project.
76+
77+
## Examples
78+
### Minimal configuration
79+
```yaml
80+
- uses: mathrix-education/setup-sentry-cli@master
81+
```
82+
By default, this minimal example will install the latest version of the
83+
Sentry CLI, without any authentication.
84+
85+
### Typical CI configuration
86+
```yaml
87+
- name: Setup Sentry CLI
88+
uses: mathrix-education/setup-sentry-cli@0.1.0
89+
with:
90+
version: latest # optional if 'latest'
91+
url: https://sentry.yourcompany.com
92+
auth: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets
93+
organization: my-org
94+
project: my-project
95+
```
96+
In this example, you provide a authentication token. The action
97+
automatically download the latest version of the Sentry CLI and
98+
authenticate using the provided token.
99+
100+
Then, the CLI is configured for the server
101+
`https://sentry.yourcompany.com` and the project `my-project` of the
102+
organization `my-org`.
103+
104+
You are now ready to use the Sentry CLI commands such as
105+
`sentry-cli releases`!

action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Setup Sentry CLI
2+
description: Setup the Sentry CLI
3+
author: Mathrix Education SA
4+
branding:
5+
color: orange
6+
icon: triangle
7+
runs:
8+
using: 'node12'
9+
main: 'dist/index.js'
10+
inputs:
11+
version:
12+
description: Sentry CLI version to use. By default, the action will use the latest one.
13+
required: false
14+
default: latest
15+
token:
16+
description: Authentication token to use. If not provided, you will have to authenticate yourself later.
17+
required: false
18+
url:
19+
description: Sentry server URL. By default, sentry-cli will use https://sentry.io.
20+
required: false
21+
organization:
22+
description: Default Sentry organization.
23+
required: false
24+
project:
25+
description: Default Sentry project.
26+
required: false

dist/index.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)