Compare commits

...

177 Commits

Author SHA1 Message Date
e6268c631a error is of unknown structure 2021-08-09 09:19:25 -04:00
8988630456 error is of unknown structure 2021-08-09 00:20:24 -04:00
c1b107442c error is of unknown structure 2021-08-09 00:18:15 -04:00
4c8c431191 error is of unknown structure 2021-08-09 00:16:19 -04:00
1505034bb0 error is of unknown structure 2021-08-09 00:14:58 -04:00
21e9098c3b more error info 2021-08-09 00:12:44 -04:00
26941a6e6b debug cross repo 2021-08-09 00:05:07 -04:00
487fcd9442 bump version 2021-08-08 12:15:54 -04:00
8b7a7c0162 stringify errors object 2021-08-08 12:12:34 -04:00
6c87482fb9 fix upload err fmt 2021-08-08 12:10:40 -04:00
2956b0de81 document input 2021-08-08 11:59:31 -04:00
0aec73c6d6 document discussion link input 2021-08-08 11:57:10 -04:00
ce95482067 bump version + update changelog 2021-08-08 11:55:10 -04:00
2861dc8673 support linking to discussions (#136)
* support linking to discussions

* fmt

* wire param
2021-08-08 02:07:02 -04:00
dd98a235fd update readme 2021-08-08 00:47:44 -04:00
4de103f838 update changelog 2021-08-08 00:31:19 -04:00
003621c2ca address asset upload warning (#134)
* bump version

* address asset upload warning

* refactor to new octokit api, work around release asset upload api

* format upload url

* unminify to debug

* try alt constructor

* utilize formatted upload url

* authorize upload

* pass token explicitly

* address conflicting uploads

* remove debugging artifacts
2021-08-08 00:28:01 -04:00
59c3b48916 add one more item to changelog 2021-07-30 18:43:29 -04:00
8779b820d9 backwards compat for GITHUB_TOKEN from env (#133)
* backwards compat for GITHUB_TOKEN from env

* update changelog
2021-07-30 18:41:53 -04:00
d2a05f5e5a fix: trimming tag_name to avoid error 422 when creating release (#130) 2021-07-30 09:09:00 -04:00
fb0163a75b update changelog and bump package.json version 2021-07-27 00:52:21 -04:00
07c2133a09 Fix 'target_commitish' is already defined (#126) 2021-07-26 22:56:30 -04:00
f5d13571ca Fix invalid ${{ github.workflow }} in readme.md (#127) 2021-07-26 12:59:56 -04:00
5e6fc64554 fix yaml table fmt 2021-07-25 20:20:53 -04:00
fdb5f68261 fmt 2021-07-25 20:14:18 -04:00
2b68b29aae update changelog 2021-07-25 20:13:03 -04:00
6aeb2b7009 Merge branch 'alerque-default-token' 2021-07-25 20:11:43 -04:00
b323b1872a update changelog 2021-07-25 20:06:54 -04:00
7fd0762403 update changelog 2021-07-25 20:06:29 -04:00
f6cd293a1e Retain original release info if the keys are not set (#109) 2021-07-25 20:04:47 -04:00
350afcd40d Update github.ts (#111) 2021-07-25 20:04:10 -04:00
7cf90a9adf Support custom target_commitish value (#76)
* Make target_commitish configurable

* Store compiled action for testing

* Add target_commitish to metadata

* Allow override of target_commitish for updating

* Print commit usage

* Improve message for commit usage

* Update draft releases too

* Revert "Update draft releases too"

This reverts commit ff30f8edb18fa851785a2d361b03c9713f5ac17d.

* Integrate latest changes from upstream.
2021-07-25 20:02:44 -04:00
51ef4d3b15 first promise rejection propagates to outer catch 2021-07-25 19:54:22 -04:00
2e6aa9a7f0 rebuild 2021-07-25 19:53:57 -04:00
12960c68c9 update changelog 2021-07-25 19:53:57 -04:00
e314c6fe22 allow creating draft releases without a tag (#95)
Co-authored-by: Doug Tangren <d.tangren@gmail.com>
2021-07-25 19:53:57 -04:00
3973e5f15a update changelog 2021-07-25 19:53:57 -04:00
cb6e676133 rebuild 2021-07-25 19:53:57 -04:00
defeeb7d92 release prep for 0.1.6 (#120) 2021-07-25 19:53:56 -04:00
9f3b580ccc lint fix and build 2021-07-25 19:53:56 -04:00
59b9126341 Retain original release info if the keys are not set (#109) 2021-07-25 19:53:56 -04:00
04c14f526b Update github.ts (#111) 2021-07-25 19:53:56 -04:00
2934fce629 Support custom target_commitish value (#76)
* Make target_commitish configurable

* Store compiled action for testing

* Add target_commitish to metadata

* Allow override of target_commitish for updating

* Print commit usage

* Improve message for commit usage

* Update draft releases too

* Revert "Update draft releases too"

This reverts commit ff30f8edb18fa851785a2d361b03c9713f5ac17d.

* Integrate latest changes from upstream.
2021-07-25 19:53:53 -04:00
674bcd2d67 Add release id to outputs (#60)
* Add release ID to outputs

* Update README
2021-07-25 19:51:58 -04:00
6f63b4506e rebuild dist/index.js (#93)
Fixes #92
2021-07-25 19:51:18 -04:00
36fae76a5c use spaces instead tab (#87) 2021-07-25 19:51:15 -04:00
5eea929306 Merge branch 'zumalabs-handle-upload-errors' 2021-07-25 19:17:18 -04:00
12d1ded340 rebuild 2021-07-25 19:16:14 -04:00
766a84c1cf update changelog 2021-07-25 19:15:36 -04:00
3c49988886 allow creating draft releases without a tag (#95)
Co-authored-by: Doug Tangren <d.tangren@gmail.com>
2021-07-25 19:15:36 -04:00
4204c40f52 update changelog 2021-07-25 19:15:36 -04:00
f1168d714c release prep for 0.1.6 (#120) 2021-07-25 19:15:12 -04:00
ccb8d16f08 lint fix and build 2021-07-25 19:15:07 -04:00
75dbd0cd0e Retain original release info if the keys are not set (#109) 2021-07-25 19:14:37 -04:00
ec9df7c385 Update github.ts (#111) 2021-07-25 19:14:15 -04:00
03c4bc34bd Support custom target_commitish value (#76)
* Make target_commitish configurable

* Store compiled action for testing

* Add target_commitish to metadata

* Allow override of target_commitish for updating

* Print commit usage

* Improve message for commit usage

* Update draft releases too

* Revert "Update draft releases too"

This reverts commit ff30f8edb18fa851785a2d361b03c9713f5ac17d.

* Integrate latest changes from upstream.
2021-07-25 19:14:12 -04:00
0a4afc0be2 Add release id to outputs (#60)
* Add release ID to outputs

* Update README
2021-07-25 19:13:46 -04:00
0a19cfc696 rebuild 2021-07-25 19:11:35 -04:00
b1829982df update changelog 2021-07-25 19:10:56 -04:00
688f58f697 allow creating draft releases without a tag (#95)
Co-authored-by: Doug Tangren <d.tangren@gmail.com>
2021-07-25 19:10:03 -04:00
08e53e60c8 update changelog 2021-07-25 19:02:03 -04:00
bb2c91bef9 rebuild 2021-07-25 19:00:48 -04:00
e020468dd2 release prep for 0.1.6 (#120) 2021-07-25 18:58:47 -04:00
5e3f23f92c lint fix and build 2021-07-17 19:37:16 -04:00
104b6490a7 Retain original release info if the keys are not set (#109) 2021-07-17 19:27:42 -04:00
a544ba8d92 Update github.ts (#111) 2021-07-17 19:24:12 -04:00
9729932bfb Support custom target_commitish value (#76)
* Make target_commitish configurable

* Store compiled action for testing

* Add target_commitish to metadata

* Allow override of target_commitish for updating

* Print commit usage

* Improve message for commit usage

* Update draft releases too

* Revert "Update draft releases too"

This reverts commit ff30f8edb18fa851785a2d361b03c9713f5ac17d.

* Integrate latest changes from upstream.
2021-05-02 20:43:58 -04:00
cebd052c1e Add release id to outputs (#60)
* Add release ID to outputs

* Update README
2021-05-01 18:56:49 -04:00
3b4957b6fd first promise rejection propagates to outer catch 2021-04-22 14:13:42 +01:00
35d938cf01 rebuild dist/index.js (#93)
Fixes #92
2021-04-09 00:46:38 -04:00
e99df7cd80 use spaces instead tab (#87) 2021-03-22 13:05:06 -04:00
05d11c9fe8 Merge remote-tracking branch 'upstream/master' into default-token 2021-03-21 10:14:08 +03:00
1f8f474abe Add upload_url as action output (#75)
* Add upload_url as action output

* Update README
2021-03-21 01:59:32 -04:00
94651eb27f Update README.md (#81) 2021-03-21 01:59:06 -04:00
dac15d39e4 fix: Get the same behavior described in Docs(#71) (#85)
Now trying read body path first then falling back on body
2021-03-21 01:52:16 -04:00
7e3b173db6 Document use of token input parameter and deprecate env var 2021-03-16 07:50:23 +03:00
d5e4f508ae Accept PAT as input and default to typically usable value 2021-03-16 07:50:02 +03:00
affa18ef97 Add repository input (#58) (#61) 2020-12-20 14:44:30 -05:00
2cf5c66450 [Security] Bump node-fetch from 2.6.0 to 2.6.1 (#66)
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. **This update includes a security fix.**
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-04 13:18:49 -05:00
aabd85678e [Security] Bump @actions/core from 1.2.0 to 1.2.6 (#68)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.0 to 1.2.6. **This update includes a security fix.**
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-04 13:17:46 -05:00
4fb86a77e0 Add 'fail_on_unmatched_files' input (#55) 2020-06-25 02:11:41 -04:00
9439581056 fix: Update to latest throttling plugin (#53)
In attempt to fix unintentional retries on 422 error from GitHub,

1. Update to latest `@octokit/plugin-throttling` version
2. Depend on `@octokit/plugin-retry` plugin as well

Issue: #52
2020-05-24 20:39:23 -04:00
9a89d1e63f Docs: Fix spelling mistakes (#50)
* README: Fix spelling mistakes

* README: Rename OSX to macOS

* CONTRIBUTING: Fix spelling mistakes
2020-04-11 23:43:21 -04:00
91409e712c rebuild index 2020-01-26 19:36:03 -05:00
b238fd05b1 consolidate
consolidate changelog notes
2020-01-26 19:34:13 -05:00
a0dc82a74f add belated release note for 0.1.5 2020-01-26 19:31:05 -05:00
924757492e Make "npm run fmt(check)" work on Windows (#41)
On Windows, single quotes cannot be used for quoting command line.
Use double quotes instead.
2020-01-12 16:48:37 -05:00
9993ae8534 Fix mistake in #39 (#40)
It should be `github.ref` or `GITHUB_REF`.
2020-01-09 18:32:41 -05:00
9f4852ebe6 Add tag_name option (#39)
Allow setting tag name like actions/create-release.
2020-01-09 01:06:19 -05:00
b7e450da2a update readme 2020-01-05 18:05:29 -05:00
6195d81339 bump version 2020-01-05 18:04:21 -05:00
2803ccaf23 updated changelog 2020-01-05 18:03:54 -05:00
c66575c5e3 try ncc for packaging (#37)
* try ncc for packaging

* consistent

* newer checkout

* update dist

* update deps

* check style a different way
2020-01-05 18:00:23 -05:00
62eba970e0 Ability to update existing release body (#36)
* Ability to update existing release body

* Updated lib, fixed typo in workflow error message
2020-01-04 01:13:45 -05:00
7a7960d4c7 Feat/upload (#34)
* feat: warn file invalid when upload

* build: update release shell

* update emoji

* build: compile main.js
2019-12-28 17:07:38 -05:00
d651ef48cb Only catch github API error (#32)
* move assignements out of try block

* include compiled code
2019-12-10 08:49:37 -05:00
37ae175992 Merge pull request #31 from skyfrk/patch-1
chore: remove note about github action beta
2019-11-14 16:53:30 -05:00
d31b44251d chore: remove note about github action beta
As of 2019-11-13 GitHub Actions are out of beta!
See: https://github.blog/2019-11-13-universe-day-one/#github-actions
2019-11-14 18:54:21 +01:00
0e414c630a Merge pull request #29 from softprops/0-1-4-release-prep
release prep
2019-10-20 19:13:36 -04:00
9a2319ecaf release prep 2019-10-20 18:15:51 -04:00
7363c39621 Merge pull request #26 from softprops/retry-api
retry api requests
2019-10-20 18:11:01 -04:00
742de9953a rebuild 2019-10-20 18:09:27 -04:00
e234343e3e rebuild and fmt 2019-10-20 18:04:32 -04:00
c99850e5d1 back to minimal set 2019-10-20 18:03:30 -04:00
845942e04a setup integration test 2019-10-20 17:50:51 -04:00
1a522d88d8 Add the release HTML URL to outputs
This will allow subsequent actions to get access to the HTML URL for the
release created with this. Handy for composing multiple actions together
that are related to the release.

In my case I wanted to get the  URL into a slack message posted to the
team when a release is published.

The output can be referenced by using the `steps.release.ouput.url` in
the workflow yaml:

    - name: Release
      id: release
      uses: softprops/action-gh-release@v1
      with:
        name: "My Release"
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Slack
      uses: csexton/slack-message-action@v1
      with:
        message: New release posted at ${{ steps.release.outputs.url}}
2019-10-20 17:50:51 -04:00
56b4c8a8ef Merge pull request #28 from csexton/output-url
Add the release HTML URL to outputs
2019-10-18 10:15:52 -04:00
723bed634e Add the release HTML URL to outputs
This will allow subsequent actions to get access to the HTML URL for the
release created with this. Handy for composing multiple actions together
that are related to the release.

In my case I wanted to get the  URL into a slack message posted to the
team when a release is published.

The output can be referenced by using the `steps.release.ouput.url` in
the workflow yaml:

    - name: Release
      id: release
      uses: softprops/action-gh-release@v1
      with:
        name: "My Release"
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Slack
      uses: csexton/slack-message-action@v1
      with:
        message: New release posted at ${{ steps.release.outputs.url}}
2019-10-18 10:09:12 -04:00
2e7c800734 retry requests 2019-10-02 20:51:12 -04:00
6247f9299a update readme 2019-09-29 08:51:03 -04:00
5d578441a6 update changelog 2019-09-29 08:46:18 -04:00
42a316b84f sync body_path fmt 2019-09-29 08:45:47 -04:00
6ecc92f5ad bump version and update changelog 2019-09-29 08:25:51 -04:00
e7b71cc1a7 Merge pull request #23 from softprops/body_path_not_used
honor body_path input when provided.
2019-09-29 08:23:25 -04:00
f26a08096a commit latest build artifacts 2019-09-29 08:16:42 -04:00
ba42ad9139 honor body_path input when provided. fixes #22 2019-09-29 02:15:58 -04:00
07c8c20669 upgrade deps 2019-09-29 02:04:47 -04:00
00c56dd770 funding 2019-09-18 23:14:09 +09:00
50c843ac1c set a better example. dont refer to @master 2019-09-18 13:38:56 +09:00
ef036888ec update changelog 2019-09-18 13:26:04 +09:00
2758344bdf bump version 2019-09-18 13:25:04 +09:00
18d8be76a0 Merge pull request #19 from softprops/pre-releases
add support for prereleases
2019-09-17 23:35:48 +09:00
2984051a42 update readme 2019-09-17 23:33:44 +09:00
a95bad53b2 add support for prereleases. fixes #17 2019-09-17 23:30:36 +09:00
bd839f3b8f Merge pull request #18 from softprops/newline-delimited-assets
add support for multi-line delimited assets
2019-09-17 23:23:56 +09:00
e812c4aca6 tabs to spaces 2019-09-17 23:22:34 +09:00
615fb448a2 changelog 2019-09-17 23:21:28 +09:00
77f9a4f575 update inputs.files.description 2019-09-17 23:16:32 +09:00
3af8783d41 support multi-line delimited assets. fixes #15 2019-09-17 23:14:30 +09:00
a6281eb824 Merge pull request #16 from softprops/draft-merger
Draft merger
2019-09-17 19:39:58 +09:00
fbe4f1f3ad update changelog 2019-09-17 19:38:31 +09:00
916d072e3d declare interface impl 2019-09-17 19:33:38 +09:00
ca93e708e3 typo in type name 2019-09-17 19:27:32 +09:00
85bb079141 ignore git modules again 2019-09-17 19:25:00 +09:00
46f6b8d27b rm node modules 2019-09-17 19:24:44 +09:00
fcf37b79bd iterating over responses not releases 2019-09-17 18:04:39 +09:00
a31211f9ff debug what comes back from our iterator 2019-09-17 17:53:48 +09:00
f3c225f2b8 regenerate js, log on tag miss for debugging 2019-09-17 17:12:53 +09:00
5f2e9fb50f revert me: integration testing 2019-09-17 13:10:47 +09:00
9f9f2a3ed2 merge drafts workaround. fixes #14 2019-09-16 23:51:16 +09:00
e2bd814f0a de-empahsize the past 2019-09-14 23:46:26 +09:00
6bdc1677a5 add demo screenshot 2019-09-11 19:23:42 +09:00
2a55ae4b12 add screenshot 2019-09-11 19:23:05 +09:00
d2403f49f5 empathy for those new to typescript projects 2019-09-09 22:00:45 +09:00
1b3edca894 call out cross platform support 2019-09-09 22:00:45 +09:00
23b784b656 Merge pull request #8 from softprops/cross-platform
refactor for cross platform use
2019-09-09 21:39:45 +09:00
29058f2f68 update changelog 2019-09-09 21:35:52 +09:00
d2e9e54ff2 readme note 2019-09-09 21:32:05 +09:00
bb78d54396 regenerate 2019-09-09 21:24:39 +09:00
ef96a2eb52 prettier 2019-09-09 21:20:59 +09:00
624fcca9a1 we're no longer publishing docker containers 2019-09-09 21:13:47 +09:00
e5cba7ebb2 remove docker ref 2019-09-09 21:13:04 +09:00
b95cbf8762 update gitignore with special note about github actions node wierdness 2019-09-09 21:12:13 +09:00
60358a145c remove node_modules 2019-09-09 21:10:40 +09:00
c7638c8893 start a changelog 2019-09-09 21:02:30 +09:00
6fa875df0b error handling 2019-09-09 21:00:04 +09:00
e197e56931 try try try again 2019-09-09 20:46:36 +09:00
cf2aed3a12 debug logging 2019-09-09 20:36:51 +09:00
d644a384fb document default release name 2019-09-09 20:17:51 +09:00
e48a25bf4e process import 2019-09-09 20:16:58 +09:00
6ef3c4f0b3 defaults are not just for documentation 2019-09-09 20:14:41 +09:00
67ba06729b node_modules 2019-09-09 20:03:40 +09:00
722f21acbd dump release trick specific to actions node_modules management 2019-09-09 19:53:59 +09:00
7ab8811117 debug workflow 2019-09-09 18:42:19 +09:00
e60d11aee8 remove previous artifacts 2019-09-09 18:39:58 +09:00
54832a3b39 top level env 2019-09-09 18:26:06 +09:00
4fe7e8efaa update actions deps 2019-09-09 18:24:28 +09:00
d30d20cc01 remove outdated comment 2019-09-09 18:16:35 +09:00
b70b9666e8 remove fs import from main 2019-09-09 18:15:01 +09:00
2940cbc2ff dont import star 2019-09-09 18:14:17 +09:00
9e07fb233a update gitignore 2019-09-09 18:08:33 +09:00
212db5146b align package.json version with repo tag 2019-09-09 18:04:49 +09:00
d27570c9ab move env to top level 2019-09-09 17:36:46 +09:00
cf0f3ebbb1 prevent github from assuming docker 2019-09-09 17:24:40 +09:00
b241ff3653 fix workflow test 2019-09-09 17:11:42 +09:00
18daf2c63f refactor for cross platform use 2019-09-09 17:10:07 +09:00
090932e783 Update README.md 2019-09-06 11:30:21 +09:00
27 changed files with 6415 additions and 2345 deletions

View File

@ -1,3 +0,0 @@
.github
target/rls
tests

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
ko_fi: softprops

View File

@ -1,9 +1,6 @@
name: Main
on:
push:
branches:
- 'master'
on: [pull_request, push]
jobs:
build:
@ -11,23 +8,19 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
# https://github.com/actions/docker/tree/master/cli
- name: Package
uses: actions/docker/cli@master
with:
args: build -t ${{ github.repository }}:latest -t ${{ github.repository }}:${{ github.sha }} .
# https://github.com/actions/docker/tree/master/login
- name: Publish Auth
uses: actions/docker/login@master
env:
# https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# https://github.com/actions/docker/tree/master/cli
- name: Publish
uses: actions/docker/cli@master
with:
args: push ${{ github.repository }}:latest
uses: actions/checkout@v2
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Format
run: npm run fmtcheck
# - name: "check for uncommitted changes"
# # Ensure no changes, but ignore node_modules dir since dev/fresh ci deps installed.
# run: |
# git diff --exit-code --stat -- . ':!node_modules' \
# || (echo "##[error] found changed files after build. please 'npm run build && npm run fmt'" \
# "and check in all changes" \
# && exit 1)

6
.gitignore vendored
View File

@ -1,2 +1,4 @@
/target
**/*.rs.bk
__tests__/runner/*
# actions requires a node_modules dir https://github.com/actions/toolkit/blob/master/docs/javascript-action.md#publish-a-releasesv1-action
# but its recommended not to check these in https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations
node_modules

86
CHANGELOG.md Normal file
View File

@ -0,0 +1,86 @@
## 0.1.10
- fixed error message formatting for file uploads
## 0.1.9
- add support for linking release to GitHub discussion [#136](https://github.com/softprops/action-gh-release/pull/136)
## 0.1.8
- address recent warnings in assert upload api as well as introduce asset upload overrides, allowing for multiple runs for the same release with the same named asserts [#134](https://github.com/softprops/action-gh-release/pull/134)
- fix backwards compatibility with `GITHUB_TOKEN` resolution. `GITHUB_TOKEN` is no resolved first from an env varibale and then from and input [#133](https://github.com/softprops/action-gh-release/pull/133)
- trim white space in provided `tag_name` [#130](https://github.com/softprops/action-gh-release/pull/130)
## 0.1.7
- allow creating draft releases without a tag [#95](https://github.com/softprops/action-gh-release/pull/95)
- Set default token for simpler setup [#83](https://github.com/softprops/action-gh-release/pull/83)
- fix regression with action yml [#126](https://github.com/softprops/action-gh-release/pull/126)
## 0.1.6
This is a release catch up have a hiatus. Future releases will happen more frequently
- Add 'fail_on_unmatched_files' input, useful for catching cases were your `files` input does not actually match what you expect [#55](https://github.com/softprops/action-gh-release/pull/55)
- Add `repository` input, useful for creating a release in an external repository [#61](https://github.com/softprops/action-gh-release/pull/61)
- Add release `id` to outputs, useful for refering to release in workflow steps following the step that uses this action [#60](https://github.com/softprops/action-gh-release/pull/60)
- Add `upload_url` as action output, useful for managing uploads separately [#75](https://github.com/softprops/action-gh-release/pull/75)
- Support custom `target_commitish` value, useful to customize the default [#76](https://github.com/softprops/action-gh-release/pull/76)
- fix `body_path` input first then fall back on `body` input. this was the originally documented precedence but was implemened the the opposite order! [#85](https://github.com/softprops/action-gh-release/pull/85)
- Retain original release info if the keys are not set, useful for filling in blanks for a release you've already started separately [#109](https://github.com/softprops/action-gh-release/pull/109)
- Limit number of times github api request to create a release is retried, useful for avoiding eating up your rate limit and action minutes do to either an invalid token or other circumstance causing the api call to fail [#111](https://github.com/softprops/action-gh-release/pull/111)
## 0.1.5
- Added support for specifying tag name [#39](https://github.com/softprops/action-gh-release/pull/39)
## 0.1.4
- Added support for updating releases body [#36](https://github.com/softprops/action-gh-release/pull/36)
- Steps can now access the url of releases with the `url` output of this Action [#28](https://github.com/softprops/action-gh-release/pull/28)
- Added basic GitHub API retry support to manage API turbulance [#26](https://github.com/softprops/action-gh-release/pull/26)
## 0.1.3
- Fixed where `with: body_path` was not being used in generated GitHub releases
## 0.1.2
- Add support for merging draft releases [#16](https://github.com/softprops/action-gh-release/pull/16)
GitHub's api doesn't explicitly have a way of fetching a draft release by tag name which caused draft releases to appear as separate releases when used in a build matrix.
This is now fixed.
- Add support for newline-delimited asset list [#18](https://github.com/softprops/action-gh-release/pull/18)
GitHub actions inputs don't inherently support lists of things and one might like to append a list of files to include in a release. Previously this was possible using a comma-delimited list of asset path patterns to upload. You can now provide these as a newline delimieted list for better readability
```yaml
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
filea.txt
fileb.txt
filec.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
- Add support for prerelease annotated GitHub releases with the new input field `with.prerelease: true` [#19](https://github.com/softprops/action-gh-release/pull/19)
---
## 0.1.1
- Add support for publishing releases on all supported virtual hosts
You'll need to remove `docker://` prefix and use the `@v1` action tag
---
## 0.1.0
- Initial release

17
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,17 @@
## bootstrapping
This a [JavaScript](https://help.github.com/en/articles/about-actions#types-of-actions) action but uses [TypeScript](https://www.typescriptlang.org/docs/home.html) to generate that JavaScript.
You can bootstrap your environment with a modern version of npm and by running `npm i` at the root of this repo.
## testing
Tests can be found under under `__tests__` directory and are runnable with the `npm t` command.
## source code
Source code can be found under the `src` directory. Running `npm run build` will generate the JavaScript that will run within GitHub workflows.
## formatting
A minimal attempt at keeping a consistent code style is can be applied by running `npm run fmt`.

1854
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +0,0 @@
[package]
name = "action-gh-release"
version = "0.1.0"
authors = ["softprops <d.tangren@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
mime = "0.3"
mime_guess = "2.0"
env_logger = "0.6"
log = "0.4"
glob = "0.3"
envy = "0.4"
# hack https://docs.rs/openssl/0.10.24/openssl/#vendored
openssl = { version = "0.10", features = ["vendored"] }
reqwest = { version = "0.9", features = ["rustls-tls"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

View File

@ -1,42 +0,0 @@
# https://hub.docker.com/_/rust?tab=tags
FROM rust:1.37.0 as builder
# musl-gcc
RUN apt-get update \
&& apt-get install -y \
musl-dev \
musl-tools \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN rustup target add x86_64-unknown-linux-musl
# cache deps https://blog.jawg.io/docker-multi-stage-build/
# RUN USER=root cargo init
# COPY Cargo.toml .
# RUN cargo build --target x86_64-unknown-linux-musl --release
# COPY src src
COPY . .
RUN cargo build --target x86_64-unknown-linux-musl --release
RUN strip /app/target/x86_64-unknown-linux-musl/release/action-gh-release
FROM scratch
# https://help.github.com/en/articles/metadata-syntax-for-github-actions#about-yaml-syntax-for-github-actions
LABEL version="0.1.0" \
repository="https://github.com/meetup/action-gh-release/" \
homepage="https://github.com/meetup/action-gh-release" \
maintainer="Meetup" \
"com.github.actions.name"="GH-Release" \
"com.github.actions.description"="Creates a new Github Release" \
"com.github.actions.icon"="package" \
"com.github.actions.color"="green"
COPY --from=builder \
/etc/ssl/certs/ca-certificates.crt \
/etc/ssl/certs/
COPY --from=builder \
/app/target/x86_64-unknown-linux-musl/release/action-gh-release \
/action-gh-release
ENTRYPOINT ["/action-gh-release"]

153
README.md
View File

@ -1,9 +1,25 @@
<div align="center">
📦 :octocat:
</div>
<h1 align="center">
action gh-release
</h1>
# action gh-release [![](https://github.com/softprops/action-gh-release/workflows/Main/badge.svg)](https://github.com/softprops/action-gh-release/actions)
<p align="center">
A GitHub Action for creating GitHub Releases on Linux, Windows, and macOS virtual environments
</p>
> A GitHub Action for creating GitHub Releases
<div align="center">
<img src="demo.png"/>
</div>
> **⚠️ Note:** To use this action, you must have access to the [GitHub Actions](https://github.com/features/actions) feature. GitHub Actions are currently only available in public beta. You can [apply for the GitHub Actions beta here](https://github.com/features/actions/signup/).
<div align="center">
<a href="https://github.com/softprops/action-gh-release/actions">
<img src="https://github.com/softprops/action-gh-release/workflows/Main/badge.svg"/>
</a>
</div>
<br />
## 🤸 Usage
@ -11,7 +27,7 @@
Typically usage of this action involves adding a step to a build that
is gated pushes to git tags. You may find `step.if` field helpful in accomplishing this
as it maximizes the resuse value of your workflow for non-tag pushes.
as it maximizes the reuse value of your workflow for non-tag pushes.
Below is a simple example of `step.if` tag gating
@ -25,22 +41,39 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v2
- name: Release
uses: docker://softprops/action-gh-release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
You can also use push config tag filter
```yaml
name: Main
on:
push:
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Release
uses: softprops/action-gh-release@v1
```
### ⬆️ Uploading release assets
You can can configure a number of options for your
You can configure a number of options for your
GitHub release and all are optional.
A common case for GitHub releases is to upload your binary after its been validated and packaged.
Use the `with.files` input to declare a comma-separated list of glob expressions matching the files
Use the `with.files` input to declare a newline-delimited list of glob expressions matching the files
you wish to upload to GitHub releases. If you'd like you can just list the files by name directly.
Below is an example of uploading a single asset named `Release.txt`
@ -55,20 +88,46 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v2
- name: Build
run: echo ${{ github.sha }} > Release.txt
- name: Test
run: cat Release.txt
- name: Release
uses: docker://softprops/action-gh-release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: Release.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
Below is an example of uploading more than one asset with a GitHub release
```yaml
name: Main
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: echo ${{ github.sha }} > Release.txt
- name: Test
run: cat Release.txt
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Release.txt
LICENSE
```
> **⚠️ Note:** Notice the `|` in the yaml syntax above ☝️. That let's you effectively declare a multi-line yaml string. You can learn more about multi-line yaml syntax [here](https://yaml-multiline.info)
### 📝 External release notes
Many systems exist that can help generate release notes for you. This action supports
@ -85,16 +144,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Generate Changeload
run: echo "# Good things have arrived" > ${{ github.workflow }}-CHANGELOG.txt
uses: actions/checkout@v2
- name: Generate Changelog
run: echo "# Good things have arrived" > ${{ github.workspace }}-CHANGELOG.txt
- name: Release
uses: docker://softprops/action-gh-release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ github.workflow }}-CHANGELOG.txt
body_path: ${{ github.workspace }}-CHANGELOG.txt
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: my_gh_org/my_gh_repo
```
### 💅 Customizing
@ -103,22 +165,47 @@ jobs:
The following are optional as `step.with` keys
| Name | Type | Description |
|-------------|---------|-----------------------------------------------------------------|
| `body` | String | Text communicating notable changes in this release |
| `body_path` | String | Path to load text communicating notable changes in this release |
| `draft` | Boolean | Indicator of whether or not this release is a draft |
| `files` | String | Comma-delimited globs of paths to assets to upload for release |
| `name` | String | Name of the release. defaults to tag name |
| Name | Type | Description |
| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `body` | String | Text communicating notable changes in this release |
| `body_path` | String | Path to load text communicating notable changes in this release |
| `draft` | Boolean | Indicator of whether or not this release is a draft |
| `prerelease` | Boolean | Indicator of whether or not is a prerelease |
| `files` | String | Newline-delimited globs of paths to assets to upload for release |
| `name` | String | Name of the release. defaults to tag name |
| `tag_name` | String | Name of a tag. defaults to `github.ref` |
| `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing |
| `repository` | String | Name of a target repository in `<owner>/<repo>` format. Defaults to GITHUB_REPOSITORY env variable |
| `target_commitish` | String | Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. |
| `token` | String | Secret GitHub Personal Access Token. Defaults to `${{ github.token }}` |
| `discussion_category_name` | String | If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see ["Managing categories for discussions in your repository."](https://docs.github.com/en/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository) |
💡When providing a `body` and `body_path` at the same time, `body_path` will be attempted first, then falling back on `body` if the path can not be read from.
💡 When providing a `body` and `body_path` at the same time, `body_path` will be
attempted first, then falling back on `body` if the path can not be read from.
💡 When the release info keys (such as `name`, `body`, `draft`, `prerelease`, etc.)
are not explicitly set and there is already an existing release for the tag, the
release will retain its original info.
#### outputs
The following outputs can be accessed via `${{ steps.<step-id>.outputs }}` from this action
| Name | Type | Description |
| ------------ | ------ | --------------------------------------- |
| `url` | String | Github.com URL for the release |
| `id` | String | Release ID |
| `upload_url` | String | URL for uploading assets to the release |
#### environment variables
The following are *required* as `step.env` keys
The following `step.env` keys are allowed as a fallback but deprecated in favor of using inputs.
| Name | Description |
|----------------|--------------------------------------|
| `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets`|
| Name | Description |
| ------------------- | ------------------------------------------------------------------------------------------ |
| `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets` |
| `GITHUB_REPOSITORY` | Name of a target repository in `<owner>/<repo>` format. defaults to the current repository |
Doug Tangren (softprops) 2019
> **⚠️ Note:** This action was previously implemented as a Docker container, limiting its use to GitHub Actions Linux virtual environments only. With recent releases, we now support cross platform usage. You'll need to remove the `docker://` prefix in these versions
Doug Tangren (softprops) 2019

25
__tests__/github.test.ts Normal file
View File

@ -0,0 +1,25 @@
//import * as assert from "assert";
//const assert = require('assert');
import * as assert from "assert";
import { mimeOrDefault, asset } from "../src/github";
describe("github", () => {
describe("mimeOrDefault", () => {
it("returns a specific mime for common path", async () => {
assert.equal(mimeOrDefault("foo.tar.gz"), "application/gzip");
});
it("returns default mime for uncommon path", async () => {
assert.equal(mimeOrDefault("foo.uncommon"), "application/octet-stream");
});
});
describe("asset", () => {
it("derives asset info from a path", async () => {
const { name, mime, size, data } = asset("tests/data/foo/bar.txt");
assert.equal(name, "bar.txt");
assert.equal(mime, "text/plain");
assert.equal(size, 10);
assert.equal(data.toString(), "release me");
});
});
});

1
__tests__/release.txt Normal file
View File

@ -0,0 +1 @@
bar

258
__tests__/util.test.ts Normal file
View File

@ -0,0 +1,258 @@
import {
releaseBody,
isTag,
paths,
parseConfig,
parseInputFiles,
unmatchedPatterns,
uploadUrl
} from "../src/util";
import * as assert from "assert";
describe("util", () => {
describe("uploadUrl", () => {
it("stripts template", () => {
assert.equal(
uploadUrl(
"https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}"
),
"https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets"
);
});
});
describe("parseInputFiles", () => {
it("parses empty strings", () => {
assert.deepStrictEqual(parseInputFiles(""), []);
});
it("parses comma-delimited strings", () => {
assert.deepStrictEqual(parseInputFiles("foo,bar"), ["foo", "bar"]);
});
it("parses newline and comma-delimited (and then some)", () => {
assert.deepStrictEqual(
parseInputFiles("foo,bar\nbaz,boom,\n\ndoom,loom "),
["foo", "bar", "baz", "boom", "doom", "loom"]
);
});
});
describe("releaseBody", () => {
it("uses input body", () => {
assert.equal(
"foo",
releaseBody({
github_ref: "",
github_repository: "",
github_token: "",
input_body: "foo",
input_body_path: undefined,
input_draft: false,
input_prerelease: false,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_target_commitish: undefined,
input_discussion_category_name: undefined
})
);
});
it("uses input body path", () => {
assert.equal(
"bar",
releaseBody({
github_ref: "",
github_repository: "",
github_token: "",
input_body: undefined,
input_body_path: "__tests__/release.txt",
input_draft: false,
input_prerelease: false,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_target_commitish: undefined,
input_discussion_category_name: undefined
})
);
});
it("defaults to body path when both body and body path are provided", () => {
assert.equal(
"bar",
releaseBody({
github_ref: "",
github_repository: "",
github_token: "",
input_body: "foo",
input_body_path: "__tests__/release.txt",
input_draft: false,
input_prerelease: false,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_target_commitish: undefined,
input_discussion_category_name: undefined
})
);
});
});
describe("parseConfig", () => {
it("parses basic config", () => {
assert.deepStrictEqual(parseConfig({}), {
github_ref: "",
github_repository: "",
github_token: "",
input_body: undefined,
input_body_path: undefined,
input_draft: undefined,
input_prerelease: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_fail_on_unmatched_files: false,
input_target_commitish: undefined,
input_discussion_category_name: undefined
});
});
it("parses basic config with commitish", () => {
assert.deepStrictEqual(
parseConfig({
INPUT_TARGET_COMMITISH: "affa18ef97bc9db20076945705aba8c516139abd"
}),
{
github_ref: "",
github_repository: "",
github_token: "",
input_body: undefined,
input_body_path: undefined,
input_draft: undefined,
input_prerelease: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_fail_on_unmatched_files: false,
input_target_commitish: "affa18ef97bc9db20076945705aba8c516139abd",
input_discussion_category_name: undefined
}
);
});
it("supports discussion category names", () => {
assert.deepStrictEqual(
parseConfig({
INPUT_DISCUSSION_CATEGORY_NAME: "releases"
}),
{
github_ref: "",
github_repository: "",
github_token: "",
input_body: undefined,
input_body_path: undefined,
input_draft: undefined,
input_prerelease: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_fail_on_unmatched_files: false,
input_target_commitish: undefined,
input_discussion_category_name: "releases"
}
);
});
it("prefers GITHUB_TOKEN over token input for backwards compatibility", () => {
assert.deepStrictEqual(
parseConfig({
INPUT_DRAFT: "false",
INPUT_PRERELEASE: "true",
GITHUB_TOKEN: "env-token",
INPUT_TOKEN: "input-token"
}),
{
github_ref: "",
github_repository: "",
github_token: "env-token",
input_body: undefined,
input_body_path: undefined,
input_draft: false,
input_prerelease: true,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_fail_on_unmatched_files: false,
input_target_commitish: undefined,
input_discussion_category_name: undefined
}
);
});
it("uses input token as the source of GITHUB_TOKEN by default", () => {
assert.deepStrictEqual(
parseConfig({
INPUT_DRAFT: "false",
INPUT_PRERELEASE: "true",
INPUT_TOKEN: "input-token"
}),
{
github_ref: "",
github_repository: "",
github_token: "input-token",
input_body: undefined,
input_body_path: undefined,
input_draft: false,
input_prerelease: true,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_fail_on_unmatched_files: false,
input_target_commitish: undefined,
input_discussion_category_name: undefined
}
);
});
it("parses basic config with draft and prerelease", () => {
assert.deepStrictEqual(
parseConfig({
INPUT_DRAFT: "false",
INPUT_PRERELEASE: "true"
}),
{
github_ref: "",
github_repository: "",
github_token: "",
input_body: undefined,
input_body_path: undefined,
input_draft: false,
input_prerelease: true,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
input_fail_on_unmatched_files: false,
input_target_commitish: undefined,
input_discussion_category_name: undefined
}
);
});
});
describe("isTag", () => {
it("returns true for tags", async () => {
assert.equal(isTag("refs/tags/foo"), true);
});
it("returns false for other kinds of refs", async () => {
assert.equal(isTag("refs/heads/master"), false);
});
});
describe("paths", () => {
it("resolves files given a set of paths", async () => {
assert.deepStrictEqual(
paths(["tests/data/**/*", "tests/data/does/not/exist/*"]),
["tests/data/foo/bar.txt"]
);
});
});
describe("unmatchedPatterns", () => {
it("returns the patterns that don't match any files", async () => {
assert.deepStrictEqual(
unmatchedPatterns(["tests/data/**/*", "tests/data/does/not/exist/*"]),
["tests/data/does/not/exist/*"]
);
});
});
});

View File

@ -1,33 +1,57 @@
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: 'GH Release'
description: 'Github Action for creating Github Releases'
author: 'softprops'
name: "GH Release"
description: "Github Action for creating Github Releases"
author: "softprops"
inputs:
body:
description: 'Note-worthy description of changes in release'
description: "Note-worthy description of changes in release"
required: false
default: 'empty'
body-path:
description: 'Path to load note-worthy description of changes in release from'
body_path:
description: "Path to load note-worthy description of changes in release from"
required: false
default: 'empty'
name:
description: 'Gives the release a custom name'
description: "Gives the release a custom name. Defaults to tag name"
required: false
tag_name:
description: "Gives a tag name. Defaults to github.GITHUB_REF"
required: false
default: 'Name of tag'
draft:
description: 'Creates a draft release'
description: "Creates a draft release. Defaults to false"
required: false
prerelease:
description: "Identify the release as a prerelease. Defaults to false"
required: false
default: 'false'
files:
description: 'Comma-delimited list of path globs for asset files to upload'
description: "Newline-delimited list of path globs for asset files to upload"
required: false
default: 'empty'
fail_on_unmatched_files:
description: "Fails if any of the `files` globs match nothing. Defaults to false"
required: false
repository:
description: "Repository to make releases against, in <owner>/<repo> format"
required: false
token:
description: "Authorized secret GitHub Personal Access Token. Defaults to github.token"
required: false
default: ${{ github.token }}
target_commitish:
description: "Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA."
required: false
discussion_category_name:
description: "If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. If there is already a discussion linked to the release, this parameter is ignored."
required: false
env:
"GITHUB_TOKEN": "As provided by Github Actions"
outputs:
url:
description: "URL to the Release HTML Page"
id:
description: "Release ID"
upload_url:
description: "URL for uploading assets to the release"
runs:
using: 'docker'
image: 'docker://softprops:action-gh-action'
env:
'GITHUB_TOKEN': 'As provided by Github Actions'
using: "node12"
main: "dist/index.js"
branding:
color: 'green'
icon: 'package'
color: "green"
icon: "package"

BIN
demo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

1
dist/index.js vendored Normal file

File diff suppressed because one or more lines are too long

11
jest.config.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}

5215
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

45
package.json Normal file
View File

@ -0,0 +1,45 @@
{
"name": "action-gh-release",
"version": "0.1.10",
"private": true,
"description": "GitHub Action for creating GitHub Releases",
"main": "lib/main.js",
"scripts": {
"build": "ncc build src/main.ts --minify",
"test": "jest",
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/softprops/action-gh-template.git"
},
"keywords": [
"actions"
],
"author": "softprops",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.4.0",
"@actions/github": "^5.0.0",
"@octokit/plugin-retry": "^3.0.9",
"@octokit/plugin-throttling": "^3.5.1",
"glob": "^7.1.6",
"mime": "^2.4.4",
"node-fetch": "^2.6.1"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/jest": "^24.0.25",
"@types/mime": "^2.0.1",
"@types/node": "^12.12.24",
"@types/node-fetch": "^2.5.12",
"@zeit/ncc": "^0.21.0",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"prettier": "1.19.1",
"ts-jest": "^24.2.0",
"typescript": "^3.7.4",
"typescript-formatter": "^7.2.2"
}
}

17
release.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# actions requires a node_modules dir https://github.com/actions/toolkit/blob/master/docs/javascript-action.md#publish-a-releasesv1-action
# but its recommended not to check these in https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations
# as such the following hack is how we dill with it
if [[ $# -ne 1 ]]; then
echo "please pass a release version. i.e. $0 v1"
exit 1
fi
git checkout -b releases/$1 # If this branch already exists, omit the -b flag
rm -rf node_modules
sed -i '/node_modules/d' .gitignore # Bash command that removes node_modules from .gitignore
npm install --production
git add node_modules -f .gitignore
git commit -m node_modules
git push origin releases/$1

View File

@ -1,4 +0,0 @@
# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#fn_args_layout
fn_args_layout = "Vertical"
# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#merge_imports
merge_imports = true

View File

@ -1,111 +0,0 @@
use mime::Mime;
use reqwest::{Body, Client, StatusCode};
use serde::{Deserialize, Serialize};
use std::{error::Error, fs::File};
#[derive(Serialize, Default, Debug, PartialEq)]
pub struct Release {
pub tag_name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub body: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub draft: Option<bool>,
}
#[derive(Deserialize)]
pub struct ReleaseResponse {
pub id: usize,
pub html_url: String,
}
pub trait Releaser {
fn release(
&self,
github_token: &str,
github_repo: &str,
release: Release,
) -> Result<ReleaseResponse, Box<dyn Error>>;
}
pub trait AssetUploader<A: Into<Body> = File> {
fn upload(
&self,
github_token: &str,
github_repo: &str,
release_id: usize,
name: &str,
mime: Mime,
asset: A,
) -> Result<StatusCode, Box<dyn Error>>;
}
impl Releaser for Client {
// https://developer.github.com/v3/repos/releases/#create-a-release
// https://developer.github.com/v3/repos/releases/#edit-a-release
fn release(
&self,
github_token: &str,
github_repo: &str,
release: Release,
) -> Result<ReleaseResponse, Box<dyn Error>> {
let endpoint = format!("https://api.github.com/repos/{}/releases", github_repo);
let mut existing = self
.get(&format!("{}/tags/{}", endpoint, release.tag_name))
.header("Authorization", format!("bearer {}", github_token))
.send()?;
match existing.status() {
StatusCode::NOT_FOUND => Ok(self
.post(&format!(
"https://api.github.com/repos/{}/releases",
github_repo
))
.header("Authorization", format!("bearer {}", github_token))
.json(&release)
.send()?
.json()?),
_ => Ok(self
.patch(&format!(
"https://api.github.com/repos/{}/releases/{}",
github_repo,
existing.json::<ReleaseResponse>()?.id
))
.header("Authorization", format!("bearer {}", github_token))
.json(&release)
.send()?
.json()?),
}
}
}
impl<A: Into<Body>> AssetUploader<A> for Client {
// https://developer.github.com/v3/repos/releases/#upload-a-release-asset
fn upload(
&self,
github_token: &str,
github_repo: &str,
release_id: usize,
name: &str,
mime: mime::Mime,
asset: A,
) -> Result<StatusCode, Box<dyn Error>> {
Ok(self
.post(&format!(
"https://uploads.github.com/repos/{}/releases/{}/assets",
github_repo, release_id
))
.header("Authorization", format!("bearer {}", github_token))
.header("Content-Type", mime.to_string())
.query(&[("name", name)])
.body(asset)
.send()?
.status())
}
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {}
}

307
src/github.ts Normal file
View File

@ -0,0 +1,307 @@
import fetch from "node-fetch";
import { GitHub } from "@actions/github/lib/utils";
import { Config, isTag, releaseBody } from "./util";
import { lstatSync, readFileSync } from "fs";
import { getType } from "mime";
import { basename } from "path";
type GitHub = InstanceType<typeof GitHub>;
export interface ReleaseAsset {
name: string;
mime: string;
size: number;
data: Buffer;
}
export interface Release {
id: number;
upload_url: string;
html_url: string;
tag_name: string;
name: string | null;
body?: string | null | undefined;
target_commitish: string;
draft: boolean;
prerelease: boolean;
assets: Array<{ id: number; name: string }>;
}
export interface Releaser {
getReleaseByTag(params: {
owner: string;
repo: string;
tag: string;
}): Promise<{ data: Release }>;
createRelease(params: {
owner: string;
repo: string;
tag_name: string;
name: string;
body: string | undefined;
draft: boolean | undefined;
prerelease: boolean | undefined;
target_commitish: string | undefined;
discussion_category_name: string | undefined;
}): Promise<{ data: Release }>;
updateRelease(params: {
owner: string;
repo: string;
release_id: number;
tag_name: string;
target_commitish: string;
name: string;
body: string | undefined;
draft: boolean | undefined;
prerelease: boolean | undefined;
discussion_category_name: string | undefined;
}): Promise<{ data: Release }>;
allReleases(params: {
owner: string;
repo: string;
}): AsyncIterableIterator<{ data: Release[] }>;
}
export class GitHubReleaser implements Releaser {
github: GitHub;
constructor(github: GitHub) {
this.github = github;
}
getReleaseByTag(params: {
owner: string;
repo: string;
tag: string;
}): Promise<{ data: Release }> {
return this.github.rest.repos.getReleaseByTag(params);
}
createRelease(params: {
owner: string;
repo: string;
tag_name: string;
name: string;
body: string | undefined;
draft: boolean | undefined;
prerelease: boolean | undefined;
target_commitish: string | undefined;
discussion_category_name: string | undefined;
}): Promise<{ data: Release }> {
return this.github.rest.repos.createRelease(params);
}
updateRelease(params: {
owner: string;
repo: string;
release_id: number;
tag_name: string;
target_commitish: string;
name: string;
body: string | undefined;
draft: boolean | undefined;
prerelease: boolean | undefined;
discussion_category_name: string | undefined;
}): Promise<{ data: Release }> {
return this.github.rest.repos.updateRelease(params);
}
allReleases(params: {
owner: string;
repo: string;
}): AsyncIterableIterator<{ data: Release[] }> {
const updatedParams = { per_page: 100, ...params };
return this.github.paginate.iterator(
this.github.rest.repos.listReleases.endpoint.merge(updatedParams)
);
}
}
export const asset = (path: string): ReleaseAsset => {
return {
name: basename(path),
mime: mimeOrDefault(path),
size: lstatSync(path).size,
data: readFileSync(path)
};
};
export const mimeOrDefault = (path: string): string => {
return getType(path) || "application/octet-stream";
};
export const upload = async (
config: Config,
github: GitHub,
url: string,
path: string,
currentAssets: Array<{ id: number; name: string }>
): Promise<any> => {
const [owner, repo] = config.github_repository.split("/");
const { name, size, mime, data: body } = asset(path);
const currentAsset = currentAssets.find(
({ name: currentName }) => currentName == name
);
if (currentAsset) {
console.log(`♻️ Deleting previously uploaded asset ${name}...`);
await github.rest.repos.deleteReleaseAsset({
asset_id: currentAsset.id || 1,
owner,
repo
});
}
console.log(`⬆️ Uploading ${name}...`);
const endpoint = new URL(url);
endpoint.searchParams.append("name", name);
const resp = await fetch(endpoint, {
headers: {
"content-length": `${size}`,
"content-type": mime,
authorization: `token ${config.github_token}`
},
method: "POST",
body
});
const json = await resp.json();
if (resp.status !== 201) {
throw new Error(
`Failed to upload release asset ${name}. recieved status code ${
resp.status
}\n${json.message}\n${JSON.stringify(json.errors)}`
);
}
return json;
};
export const release = async (
config: Config,
releaser: Releaser,
maxRetries: number = 3
): Promise<Release> => {
if (maxRetries <= 0) {
console.log(`❌ Too many retries. Aborting...`);
throw new Error("Too many retries.");
}
const [owner, repo] = config.github_repository.split("/");
const tag =
config.input_tag_name ||
(isTag(config.github_ref)
? config.github_ref.replace("refs/tags/", "")
: "");
const discussion_category_name = config.input_discussion_category_name;
try {
// you can't get a an existing draft by tag
// so we must find one in the list of all releases
if (config.input_draft) {
for await (const response of releaser.allReleases({
owner,
repo
})) {
let release = response.data.find(release => release.tag_name === tag);
if (release) {
return release;
}
}
}
let existingRelease = await releaser.getReleaseByTag({
owner,
repo,
tag
});
const release_id = existingRelease.data.id;
let target_commitish: string;
if (
config.input_target_commitish &&
config.input_target_commitish !== existingRelease.data.target_commitish
) {
console.log(
`Updating commit from "${existingRelease.data.target_commitish}" to "${config.input_target_commitish}"`
);
target_commitish = config.input_target_commitish;
} else {
target_commitish = existingRelease.data.target_commitish;
}
const tag_name = tag;
const name = config.input_name || existingRelease.data.name || tag;
let body: string = "";
if (existingRelease.data.body) body += existingRelease.data.body;
let workflowBody = releaseBody(config);
if (existingRelease.data.body && workflowBody) body += "\n";
if (workflowBody) body += workflowBody;
const draft =
config.input_draft !== undefined
? config.input_draft
: existingRelease.data.draft;
const prerelease =
config.input_prerelease !== undefined
? config.input_prerelease
: existingRelease.data.prerelease;
const release = await releaser.updateRelease({
owner,
repo,
release_id,
tag_name,
target_commitish,
name,
body,
draft,
prerelease,
discussion_category_name
});
return release.data;
} catch (error) {
if (error.status === 404) {
const tag_name = tag;
const name = config.input_name || tag;
const body = releaseBody(config);
const draft = config.input_draft;
const prerelease = config.input_prerelease;
const target_commitish = config.input_target_commitish;
let commitMessage: string = "";
if (target_commitish) {
commitMessage = ` using commit "${target_commitish}"`;
}
console.log(
`👩‍🏭 Creating new GitHub release in ${owner}/${repo} for tag ${tag_name}${commitMessage}...`
);
try {
let release = await releaser.createRelease({
owner,
repo,
tag_name,
name,
body,
draft,
prerelease,
target_commitish,
discussion_category_name
});
return release.data;
} catch (error) {
// presume a race with competing metrix runs
console.log(
`⚠️ GitHub release failed with status: ${
error.status
}\n${JSON.stringify(
error.response.data.errors
)}\nretrying... (${maxRetries - 1} retries remaining)`
);
return release(config, releaser, maxRetries - 1);
}
} else {
console.log(
`⚠️ Unexpected error fetching GitHub release for tag ${config.github_ref}: ${error}`
);
throw error;
}
}
};

View File

@ -1,232 +0,0 @@
mod github;
use github::{AssetUploader, Release, ReleaseResponse, Releaser};
use mime::Mime;
use reqwest::Client;
use serde::Deserialize;
use std::{
error::Error,
ffi::OsStr,
fs::{read_to_string, File},
path::{Path, PathBuf},
};
type BoxError = Box<dyn Error>;
#[derive(Deserialize, Default, Debug, PartialEq, Clone)]
struct Config {
// github provided
github_token: String,
github_ref: String,
github_repository: String,
// user provided
input_name: Option<String>,
input_body: Option<String>,
input_body_path: Option<PathBuf>,
input_files: Option<Vec<String>>,
input_draft: Option<bool>,
}
impl Into<Release> for Config {
fn into(self) -> Release {
let Config {
github_ref,
input_name,
input_body,
input_body_path,
input_draft,
..
} = self;
let tag_name = github_ref.trim_start_matches("refs/tags/").to_string();
let name = input_name.clone().or_else(|| Some(tag_name.clone()));
let draft = input_draft;
let body = input_body_path
.and_then(|path| read_to_string(path).ok())
.or_else(|| input_body.clone());
Release {
tag_name,
name,
body,
draft,
}
}
}
fn is_tag<R>(gitref: R) -> bool
where
R: AsRef<str>,
{
gitref.as_ref().starts_with("refs/tags/")
}
fn mime_or_default<P>(path: P) -> Mime
where
P: AsRef<Path>,
{
mime_guess::from_path(path).first_or(mime::APPLICATION_OCTET_STREAM)
}
fn paths<P>(
patterns: impl IntoIterator<Item = P>
) -> Result<impl IntoIterator<Item = PathBuf>, BoxError>
where
P: AsRef<str>,
{
patterns
.into_iter()
.try_fold(Vec::new(), |mut paths, pattern| {
let matched = glob::glob(pattern.as_ref())?
.filter_map(Result::ok)
.filter(|p| p.is_file());
paths.extend(matched);
Ok(paths)
})
}
fn run(
conf: Config,
releaser: &dyn Releaser,
uploader: &dyn AssetUploader,
) -> Result<(), BoxError> {
if !is_tag(&conf.github_ref) {
eprintln!("⚠️ GitHub Releases requires a tag");
return Ok(());
}
let ReleaseResponse { id, html_url } = releaser.release(
conf.github_token.as_str(),
conf.github_repository.as_str(),
conf.clone().into(),
)?;
if let Some(patterns) = conf.input_files {
for path in paths(patterns)? {
let name = &path
.file_name()
.and_then(OsStr::to_str)
.unwrap_or_else(|| "UnknownFile");
println!("⬆️ Uploading {}...", name);
let status = uploader.upload(
conf.github_token.as_str(),
conf.github_repository.as_str(),
id,
name,
mime_or_default(&path),
File::open(&path)?,
)?;
if !status.is_success() {
println!("⚠️ Failed uploading {} with error {}", name, status);
}
}
}
println!("🎉 Release ready at {}", html_url);
Ok(())
}
fn main() -> Result<(), BoxError> {
env_logger::init();
let client = Client::new();
run(envy::from_env()?, &client, &client)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn mime_or_default_defaults_to_octect_stream() {
assert_eq!(
mime_or_default("umbiguous-file"),
mime::APPLICATION_OCTET_STREAM
)
}
#[test]
fn release_constructs_a_release_from_a_config() -> Result<(), BoxError> {
for (conf, expect) in vec![
(
Config {
github_ref: "refs/tags/v1.0.0".into(),
..Config::default()
},
Release {
tag_name: "v1.0.0".into(),
name: Some("v1.0.0".into()),
..Release::default()
},
),
(
Config {
github_ref: "refs/tags/v1.0.0".into(),
input_name: Some("custom".into()),
..Config::default()
},
Release {
tag_name: "v1.0.0".into(),
name: Some("custom".into()),
..Release::default()
},
),
(
Config {
github_ref: "refs/tags/v1.0.0".into(),
input_body: Some("fallback".into()),
input_body_path: Some("tests/data/foo/bar.txt".into()),
..Config::default()
},
Release {
tag_name: "v1.0.0".into(),
name: Some("v1.0.0".into()),
body: Some("release me".into()),
..Release::default()
},
),
] {
assert_eq!(expect, conf.into());
}
Ok(())
}
#[test]
fn is_tag_checks_refs() {
for (gitref, expect) in &[("refs/tags/foo", true), ("refs/heads/master", false)] {
assert_eq!(is_tag(gitref), *expect)
}
}
#[test]
fn paths_resolves_pattern_to_file_paths() -> Result<(), BoxError> {
assert_eq!(paths(vec!["tests/data/**/*"])?.into_iter().count(), 1);
Ok(())
}
#[test]
fn config_is_parsed_from_env() -> Result<(), BoxError> {
for (env, expect) in vec![(
vec![
("GITHUB_TOKEN".into(), "123".into()),
("GITHUB_REF".into(), "refs/tags/v1.0.0".into()),
("GITHUB_REPOSITORY".into(), "foo/bar".into()),
("INPUT_NAME".into(), "test release".into()),
("INPUT_BODY".into(), ":)".into()),
("INPUT_FILES".into(), "*.md".into()),
("INPUT_DRAFT".into(), "true".into()),
("INPUT_BODY_PATH".into(), "tests/data/foo/bar.txt".into()),
],
Config {
github_token: "123".into(),
github_ref: "refs/tags/v1.0.0".into(),
github_repository: "foo/bar".into(),
input_name: Some("test release".into()),
input_body: Some(":)".into()),
input_body_path: Some("tests/data/foo/bar.txt".into()),
input_files: Some(vec!["*.md".into()]),
input_draft: Some(true),
},
)] {
assert_eq!(expect, envy::from_iter::<_, Config>(env)?)
}
Ok(())
}
}

92
src/main.ts Normal file
View File

@ -0,0 +1,92 @@
import {
paths,
parseConfig,
isTag,
unmatchedPatterns,
uploadUrl
} from "./util";
import { release, upload, GitHubReleaser } from "./github";
import { getOctokit } from "@actions/github";
import { setFailed, setOutput } from "@actions/core";
import { GitHub, getOctokitOptions } from "@actions/github/lib/utils";
import { env } from "process";
async function run() {
try {
const config = parseConfig(env);
if (
!config.input_tag_name &&
!isTag(config.github_ref) &&
!config.input_draft
) {
throw new Error(`⚠️ GitHub Releases requires a tag`);
}
if (config.input_files) {
const patterns = unmatchedPatterns(config.input_files);
patterns.forEach(pattern =>
console.warn(`🤔 Pattern '${pattern}' does not match any files.`)
);
if (patterns.length > 0 && config.input_fail_on_unmatched_files) {
throw new Error(`⚠️ There were unmatched files`);
}
}
// const oktokit = GitHub.plugin(
// require("@octokit/plugin-throttling"),
// require("@octokit/plugin-retry")
// );
const gh = getOctokit(config.github_token, {
//new oktokit(
throttle: {
onRateLimit: (retryAfter, options) => {
console.warn(
`Request quota exhausted for request ${options.method} ${options.url}`
);
if (options.request.retryCount === 0) {
// only retries once
console.log(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
onAbuseLimit: (retryAfter, options) => {
// does not retry, only logs a warning
console.warn(
`Abuse detected for request ${options.method} ${options.url}`
);
}
}
});
//);
const rel = await release(config, new GitHubReleaser(gh));
if (config.input_files) {
const files = paths(config.input_files);
if (files.length == 0) {
console.warn(`🤔 ${config.input_files} not include valid file.`);
}
const currentAsserts = rel.assets;
await Promise.all(
files.map(async path => {
await upload(
config,
gh,
uploadUrl(rel.upload_url),
path,
currentAsserts
);
})
).catch(error => {
throw error;
});
}
console.log(`🎉 Release ready at ${rel.html_url}`);
setOutput("url", rel.html_url);
setOutput("id", rel.id.toString());
setOutput("upload_url", rel.upload_url);
} catch (error) {
setFailed(error.message);
}
}
run();

91
src/util.ts Normal file
View File

@ -0,0 +1,91 @@
import * as glob from "glob";
import { lstatSync, readFileSync } from "fs";
export interface Config {
github_token: string;
github_ref: string;
github_repository: string;
// user provided
input_name?: string;
input_tag_name?: string;
input_repository?: string;
input_body?: string;
input_body_path?: string;
input_files?: string[];
input_draft?: boolean;
input_prerelease?: boolean;
input_fail_on_unmatched_files?: boolean;
input_target_commitish?: string;
input_discussion_category_name?: string;
}
export const uploadUrl = (url: string): string => {
const templateMarkerPos = url.indexOf("{");
if (templateMarkerPos > -1) {
return url.substring(0, templateMarkerPos);
}
return url;
};
export const releaseBody = (config: Config): string | undefined => {
return (
(config.input_body_path &&
readFileSync(config.input_body_path).toString("utf8")) ||
config.input_body
);
};
type Env = { [key: string]: string | undefined };
export const parseInputFiles = (files: string): string[] => {
return files.split(/\r?\n/).reduce<string[]>(
(acc, line) =>
acc
.concat(line.split(","))
.filter(pat => pat)
.map(pat => pat.trim()),
[]
);
};
export const parseConfig = (env: Env): Config => {
return {
github_token: env.GITHUB_TOKEN || env.INPUT_TOKEN || "",
github_ref: env.GITHUB_REF || "",
github_repository: env.INPUT_REPOSITORY || env.GITHUB_REPOSITORY || "",
input_name: env.INPUT_NAME,
input_tag_name: env.INPUT_TAG_NAME?.trim(),
input_body: env.INPUT_BODY,
input_body_path: env.INPUT_BODY_PATH,
input_files: parseInputFiles(env.INPUT_FILES || ""),
input_draft: env.INPUT_DRAFT ? env.INPUT_DRAFT === "true" : undefined,
input_prerelease: env.INPUT_PRERELEASE
? env.INPUT_PRERELEASE == "true"
: undefined,
input_fail_on_unmatched_files: env.INPUT_FAIL_ON_UNMATCHED_FILES == "true",
input_target_commitish: env.INPUT_TARGET_COMMITISH,
input_discussion_category_name: env.INPUT_DISCUSSION_CATEGORY_NAME
};
};
export const paths = (patterns: string[]): string[] => {
return patterns.reduce((acc: string[], pattern: string): string[] => {
return acc.concat(
glob.sync(pattern).filter(path => lstatSync(path).isFile())
);
}, []);
};
export const unmatchedPatterns = (patterns: string[]): string[] => {
return patterns.reduce((acc: string[], pattern: string): string[] => {
return acc.concat(
glob.sync(pattern).filter(path => lstatSync(path).isFile()).length == 0
? [pattern]
: []
);
}, []);
};
export const isTag = (ref: string): boolean => {
return ref.startsWith("refs/tags/");
};

63
tsconfig.json Normal file
View File

@ -0,0 +1,63 @@
{
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
},
"exclude": ["node_modules", "**/*.test.ts"]
}