Merge pull request #1 from getsentry/feat/init
This commit is contained in:
+1
-9
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"plugins": ["jest", "@typescript-eslint"],
|
||||
"extends": ["plugin:github/es6"],
|
||||
"extends": ["plugin:github/recommended"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
@@ -16,13 +16,9 @@
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/array-type": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/ban-ts-ignore": "error",
|
||||
"camelcase": "off",
|
||||
"@typescript-eslint/camelcase": "error",
|
||||
"@typescript-eslint/class-name-casing": "error",
|
||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
||||
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
@@ -32,7 +28,6 @@
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||
"@typescript-eslint/no-object-literal-type-assertion": "error",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
@@ -40,13 +35,10 @@
|
||||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"@typescript-eslint/prefer-function-type": "warn",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-interface": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/promise-function-async": "error",
|
||||
"@typescript-eslint/require-array-sort-compare": "error",
|
||||
"@typescript-eslint/restrict-plus-operands": "error",
|
||||
"semi": "off",
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "error"
|
||||
},
|
||||
|
||||
+8
-1
@@ -81,6 +81,10 @@ typings/
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vercel build output
|
||||
dist/
|
||||
!dist/index.js
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
@@ -96,4 +100,7 @@ Thumbs.db
|
||||
|
||||
# Ignore built ts files
|
||||
__tests__/runner/*
|
||||
lib/**/*
|
||||
lib/**/*
|
||||
|
||||
# IDE settings
|
||||
.idea/
|
||||
|
||||
@@ -1,101 +1,30 @@
|
||||
<p align="center">
|
||||
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
|
||||
</p>
|
||||
# Sentry Release GitHub Action
|
||||
A release is a version of your code that is deployed to an environment. When you give Sentry information about your releases, you unlock a number of new features:
|
||||
|
||||
# Create a JavaScript Action using TypeScript
|
||||
- Determine the issues and regressions introduced in a new release
|
||||
- Predict which commit caused an issue and who is likely responsible
|
||||
- Resolve issues by including the issue number in your commit message
|
||||
- Receive email notifications when your code gets deployed
|
||||
|
||||
Use this template to bootstrap the creation of a JavaScript action.:rocket:
|
||||
Additionally, releases are used for applying source maps to minified JavaScript to view original, untransformed source code.
|
||||
|
||||
This template includes compilication support, tests, a validation workflow, publishing, and versioning guidance.
|
||||
|
||||
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
|
||||
|
||||
## Create an action from this template
|
||||
|
||||
Click the `Use this Template` and provide the new repo details for your action
|
||||
|
||||
## Code in Master
|
||||
|
||||
Install the dependencies
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
Build the typescript and package it for distribution
|
||||
```bash
|
||||
$ npm run build && npm run pack
|
||||
```
|
||||
|
||||
Run the tests :heavy_check_mark:
|
||||
```bash
|
||||
$ npm test
|
||||
|
||||
PASS ./index.test.js
|
||||
✓ throws invalid number (3ms)
|
||||
✓ wait 500 ms (504ms)
|
||||
✓ test runs (95ms)
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
## Change action.yml
|
||||
|
||||
The action.yml contains defines the inputs and output for your action.
|
||||
|
||||
Update the action.yml with your name, description, inputs and outputs for your action.
|
||||
|
||||
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
|
||||
|
||||
## Change the Code
|
||||
|
||||
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
|
||||
|
||||
```javascript
|
||||
import * as core from '@actions/core';
|
||||
...
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
...
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
```
|
||||
|
||||
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
|
||||
|
||||
## Publish to a distribution branch
|
||||
|
||||
Actions are run from GitHub repos so we will checkin the packed dist folder.
|
||||
|
||||
Then run [ncc](https://github.com/zeit/ncc) and push the results:
|
||||
```bash
|
||||
$ npm run pack
|
||||
$ git add dist
|
||||
$ git commit -a -m "prod dependencies"
|
||||
$ git push origin releases/v1
|
||||
```
|
||||
|
||||
Your action is now published! :rocket:
|
||||
|
||||
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
|
||||
|
||||
## Validate
|
||||
|
||||
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml)])
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
uses: ./
|
||||
with:
|
||||
milliseconds: 1000
|
||||
steps:
|
||||
...
|
||||
- name: Sentry Release
|
||||
uses: getsentry/[email protected]
|
||||
with:
|
||||
environment: 'production'
|
||||
sourcemaps: './lib'
|
||||
```
|
||||
|
||||
See the [actions tab](https://github.com/actions/javascript-action/actions) for runs of this action! :rocket:
|
||||
## Troubleshooting
|
||||
|
||||
## Usage:
|
||||
|
||||
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action
|
||||
## Contributing
|
||||
See the [Contributing Guide](https://github.com/getsentry/github-action-release/blob/master/CONTRIBUTING).
|
||||
|
||||
## License
|
||||
See the [License File](https://github.com/getsentry/github-action-release/blob/master/LICENSE).
|
||||
+18
-6
@@ -1,10 +1,22 @@
|
||||
name: 'Your name here'
|
||||
description: 'Provide a description here'
|
||||
author: 'Your name or organization here'
|
||||
name: 'Sentry Release'
|
||||
description: 'GitHub Action for creating a release on Sentry'
|
||||
author: 'Sentry'
|
||||
inputs:
|
||||
myInput: # change this
|
||||
description: 'input description here'
|
||||
default: 'default value if applicable'
|
||||
environment:
|
||||
description: 'The name of the environment. E.g. production. TODO'
|
||||
required: true
|
||||
sourcemaps:
|
||||
description: 'Space-separated list of paths to JavaScript sourcemaps. Omit to skip _sending_ sourcemaps.'
|
||||
required: false
|
||||
skip_finalize:
|
||||
description: 'When true, omit setting the _TODO_ timestamp on the release.'
|
||||
default: false
|
||||
started_at:
|
||||
description: 'Unix timestamp '
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
branding:
|
||||
icon: 'triangle'
|
||||
color: 'purple'
|
||||
|
||||
Vendored
+935
-209
File diff suppressed because it is too large
Load Diff
Generated
+10026
-2486
File diff suppressed because it is too large
Load Diff
+23
-21
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "typescript-action",
|
||||
"version": "0.0.0",
|
||||
"name": "github-action-release",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"description": "TypeScript template action",
|
||||
"description": "GitHub Action for creating a release on Sentry",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
@@ -15,31 +15,33 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/typescript-action.git"
|
||||
"url": "git+https://github.com/getsentry/github-action-release.git"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
"node",
|
||||
"setup"
|
||||
"sentry",
|
||||
"release"
|
||||
],
|
||||
"author": "YourNameOrOrganization",
|
||||
"author": "Sentry",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.0"
|
||||
"@actions/core": "^1.2.4",
|
||||
"@sentry/cli": "^1.54.0",
|
||||
"@sentry/types": "^5.17.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.23",
|
||||
"@types/node": "^12.7.12",
|
||||
"@typescript-eslint/parser": "^2.8.0",
|
||||
"@zeit/ncc": "^0.20.5",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-github": "^2.0.0",
|
||||
"eslint-plugin-jest": "^22.21.0",
|
||||
"jest": "^24.9.0",
|
||||
"jest-circus": "^24.9.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"prettier": "^1.19.1",
|
||||
"ts-jest": "^24.2.0",
|
||||
"typescript": "^3.6.4"
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/node": "^14.0.13",
|
||||
"@typescript-eslint/parser": "^3.3.0",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"eslint": "^7.2.0",
|
||||
"eslint-plugin-github": "^4.0.1",
|
||||
"eslint-plugin-jest": "^23.13.2",
|
||||
"jest": "^26.0.1",
|
||||
"jest-circus": "^26.0.1",
|
||||
"js-yaml": "^3.14.0",
|
||||
"prettier": "^2.0.5",
|
||||
"ts-jest": "^26.1.0",
|
||||
"typescript": "^3.9.5"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
declare module '@sentry/cli' {
|
||||
export class Releases {
|
||||
constructor(configFile: string, options?: {silent?: boolean});
|
||||
new(release: string): Promise<void>;
|
||||
setCommits(
|
||||
release: string,
|
||||
options: {
|
||||
repo?: string;
|
||||
auto?: boolean;
|
||||
commit?: string;
|
||||
previousCommit?: string;
|
||||
}
|
||||
): Promise<void>;
|
||||
finalize(release: string): Promise<void>;
|
||||
proposeVersion(): Promise<string>;
|
||||
uploadSourceMaps(
|
||||
release: string,
|
||||
options: {
|
||||
include: string[];
|
||||
ignore?: string[];
|
||||
ignoreFile?: string;
|
||||
rewrite?: boolean;
|
||||
sourceMapReference?: boolean;
|
||||
stripPrefix?: string[];
|
||||
stripCommonPrefix?: boolean;
|
||||
validate?: boolean;
|
||||
urlPrefix?: string;
|
||||
urlSuffix?: string;
|
||||
ext?: string[];
|
||||
}
|
||||
): Promise<void>;
|
||||
listDeploys(release: string): Promise<string[]>;
|
||||
newDeploy(
|
||||
release: string,
|
||||
options: {
|
||||
env: string;
|
||||
started?: number;
|
||||
finished?: number;
|
||||
time?: number;
|
||||
name?: string;
|
||||
url?: string;
|
||||
}
|
||||
): Promise<void>;
|
||||
execute(args: string[], live: boolean): Promise<string>;
|
||||
}
|
||||
|
||||
export class SentryCli {
|
||||
constructor(options?: {configFile?: string; silent?: boolean});
|
||||
releases: Releases;
|
||||
}
|
||||
|
||||
export default SentryCli;
|
||||
}
|
||||
+13
-10
@@ -1,19 +1,22 @@
|
||||
import * as core from '@actions/core'
|
||||
import {wait} from './wait'
|
||||
import * as core from '@actions/core';
|
||||
import SentryCli from '@sentry/cli';
|
||||
import {wait} from './wait';
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
const ms: string = core.getInput('milliseconds')
|
||||
core.debug(`Waiting ${ms} milliseconds ...`)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const cli = new SentryCli();
|
||||
const ms: string = core.getInput('milliseconds');
|
||||
core.debug(`Waiting ${ms} milliseconds ...`);
|
||||
|
||||
core.debug(new Date().toTimeString())
|
||||
await wait(parseInt(ms, 10))
|
||||
core.debug(new Date().toTimeString())
|
||||
core.debug(new Date().toTimeString());
|
||||
await wait(parseInt(ms, 10));
|
||||
core.debug(new Date().toTimeString());
|
||||
|
||||
core.setOutput('time', new Date().toTimeString())
|
||||
core.setOutput('time', new Date().toTimeString());
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
run();
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
export async function wait(milliseconds: number): Promise<string> {
|
||||
return new Promise(resolve => {
|
||||
if (isNaN(milliseconds)) {
|
||||
throw new Error('milliseconds not a number')
|
||||
throw new Error('milliseconds not a number');
|
||||
}
|
||||
|
||||
setTimeout(() => resolve('done!'), milliseconds)
|
||||
})
|
||||
setTimeout(() => resolve('done!'), milliseconds);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user