generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from kaliber5/update-release
Update release
- Loading branch information
Showing
19 changed files
with
7,773 additions
and
1,093 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,27 @@ | ||
{ | ||
"plugins": ["jest", "@typescript-eslint"], | ||
"extends": ["plugin:github/recommended"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 9, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": { | ||
"eslint-comments/no-use": "off", | ||
"import/no-namespace": "off", | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": "error", | ||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}], | ||
"@typescript-eslint/no-require-imports": "error", | ||
"@typescript-eslint/array-type": "error", | ||
"@typescript-eslint/await-thenable": "error", | ||
"@typescript-eslint/ban-ts-comment": "error", | ||
"camelcase": "off", | ||
"@typescript-eslint/consistent-type-assertions": "error", | ||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}], | ||
"@typescript-eslint/func-call-spacing": ["error", "never"], | ||
"@typescript-eslint/no-array-constructor": "error", | ||
"@typescript-eslint/no-empty-interface": "error", | ||
"@typescript-eslint/no-explicit-any": "error", | ||
"@typescript-eslint/no-extraneous-class": "error", | ||
"@typescript-eslint/no-for-in-array": "error", | ||
"@typescript-eslint/no-inferrable-types": "error", | ||
"@typescript-eslint/no-misused-new": "error", | ||
"@typescript-eslint/no-namespace": "error", | ||
"@typescript-eslint/no-non-null-assertion": "warn", | ||
"@typescript-eslint/no-unnecessary-qualifier": "error", | ||
"@typescript-eslint/no-unnecessary-type-assertion": "error", | ||
"@typescript-eslint/no-useless-constructor": "error", | ||
"@typescript-eslint/no-var-requires": "error", | ||
"@typescript-eslint/prefer-for-of": "warn", | ||
"@typescript-eslint/prefer-function-type": "warn", | ||
"@typescript-eslint/prefer-includes": "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" | ||
}, | ||
"env": { | ||
"node": true, | ||
"es6": true, | ||
"jest/globals": true | ||
} | ||
} | ||
"plugins": [ | ||
"jest", | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"plugin:github/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"env": { | ||
"node": true, | ||
"es6": true, | ||
"jest/globals": true | ||
}, | ||
"rules": { | ||
"camelcase": "off" | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,4 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"bracketSpacing": false, | ||
"arrowParens": "avoid" | ||
"printWidth": 120, | ||
"singleQuote": true | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +1,55 @@ | ||
<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> | ||
# Update a release | ||
|
||
# Create a JavaScript Action using TypeScript | ||
[![build-test](https://github.com/kaliber5/action-update-release/actions/workflows/test.yml/badge.svg)](https://github.com/kaliber5/action-update-release/actions/workflows/test.yml) | ||
|
||
Use this template to bootstrap the creation of a TypeScript action.:rocket: | ||
Github action to update a Github release given by its ID. Can be used in combination with [`kaliber5/action-get-release`](https://github.com/kaliber5/action-get-release). | ||
|
||
This template includes compilation 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 Main | ||
|
||
> First, you'll need to have a reasonably modern version of `node` handy. This won't work with versions older than 9, for instance. | ||
Install the dependencies | ||
```bash | ||
$ npm install | ||
``` | ||
|
||
Build the typescript and package it for distribution | ||
```bash | ||
$ npm run build && npm run package | ||
``` | ||
|
||
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 package | ||
$ git add dist | ||
$ git commit -a -m "prod dependencies" | ||
$ git push origin releases/v1 | ||
``` | ||
|
||
Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project. | ||
|
||
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 | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get latest release | ||
id: latest_release | ||
uses: kaliber5/action-get-release@v1 | ||
with: | ||
token: ${{ github.token }} | ||
latest: true | ||
- name: Update release | ||
uses: kaliber5/action-update-release@v1 | ||
with: | ||
token: ${{ github.token }} | ||
id: ${{ steps.latest_release.outputs.id }} | ||
name: My changed release name | ||
``` | ||
See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket: | ||
## 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 | ||
### Inputs | ||
- `token`: The Github token used for authentication. Required, `${{ github.token }}` can be used usually. | ||
- `owner`: Name of the owner of the repo, taken from current repo by default. | ||
- `repo`: Name of the repository, taken from current repo by default. | ||
- `id`: The ID to identify the release. Required! | ||
- `name`: Name of the release | ||
- `body`: Body text of the release. | ||
- `tag_name`: Tag name of the release. | ||
- `target_commitish`: Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. | ||
- `prerelease`: Mark this release as a pre-release. | ||
- `draft`: Set to false to publish a draft release. | ||
|
||
### Outputs | ||
|
||
- `id`: The ID of the Release | ||
- `url`: The release url | ||
- `html_url`: The url users can navigate to in order to view the release | ||
- `assets_url`: The release assets url | ||
- `upload_url`: The url for uploading assets to the release | ||
- `name`: The release name | ||
- `body`: The release's body content | ||
- `tag_name`: The git tag associated with the release | ||
- `draft`: Is draft | ||
- `prerelease`: Is pre-release | ||
- `target_commitish`: The release was create to which target branch | ||
- `created_at`: Created date | ||
- `published_at`: Published date |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"url": "https://api.github.com/repos/octocat/Hello-World/releases/1", | ||
"html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0", | ||
"assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets", | ||
"upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}", | ||
"tarball_url": "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0", | ||
"zipball_url": "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0", | ||
"discussion_url": "https://github.com/octocat/Hello-World/discussions/90", | ||
"id": 1, | ||
"node_id": "MDc6UmVsZWFzZTE=", | ||
"tag_name": "v1.0.0", | ||
"target_commitish": "master", | ||
"name": "NEW NAME", | ||
"body": "NEW BODY", | ||
"draft": false, | ||
"prerelease": false, | ||
"created_at": "2013-02-27T19:35:32Z", | ||
"published_at": "2013-02-27T19:35:32Z", | ||
"author": { | ||
"login": "octocat", | ||
"id": 1, | ||
"node_id": "MDQ6VXNlcjE=", | ||
"avatar_url": "https://github.com/images/error/octocat_happy.gif", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/octocat", | ||
"html_url": "https://github.com/octocat", | ||
"followers_url": "https://api.github.com/users/octocat/followers", | ||
"following_url": "https://api.github.com/users/octocat/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions", | ||
"organizations_url": "https://api.github.com/users/octocat/orgs", | ||
"repos_url": "https://api.github.com/users/octocat/repos", | ||
"events_url": "https://api.github.com/users/octocat/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/octocat/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"assets": [ | ||
{ | ||
"url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1", | ||
"browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip", | ||
"id": 1, | ||
"node_id": "MDEyOlJlbGVhc2VBc3NldDE=", | ||
"name": "example.zip", | ||
"label": "short description", | ||
"state": "uploaded", | ||
"content_type": "application/zip", | ||
"size": 1024, | ||
"download_count": 42, | ||
"created_at": "2013-02-27T19:35:32Z", | ||
"updated_at": "2013-02-27T19:35:32Z", | ||
"uploader": { | ||
"login": "octocat", | ||
"id": 1, | ||
"node_id": "MDQ6VXNlcjE=", | ||
"avatar_url": "https://github.com/images/error/octocat_happy.gif", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/octocat", | ||
"html_url": "https://github.com/octocat", | ||
"followers_url": "https://api.github.com/users/octocat/followers", | ||
"following_url": "https://api.github.com/users/octocat/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions", | ||
"organizations_url": "https://api.github.com/users/octocat/orgs", | ||
"repos_url": "https://api.github.com/users/octocat/repos", | ||
"events_url": "https://api.github.com/users/octocat/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/octocat/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
} | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"id": "1", | ||
"url": "https://api.github.com/repos/octocat/Hello-World/releases/1", | ||
"html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0", | ||
"assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets", | ||
"upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}", | ||
"name": "NEW NAME", | ||
"body": "NEW BODY", | ||
"tag_name": "v1.0.0", | ||
"draft": "false", | ||
"prerelease": "false", | ||
"target_commitish": "master", | ||
"created_at": "2013-02-27T19:35:32Z", | ||
"published_at": "2013-02-27T19:35:32Z" | ||
} |
Oops, something went wrong.