188 Commits
1.0.0 ... 2.5.0

Author SHA1 Message Date
Sven-Hendrik Haase
7319e4733e 2.5.0 2023-02-21 15:45:38 +01:00
Sven-Hendrik Haase
4e86b8565b Prepare release 2023-02-21 15:11:15 +01:00
Sven-Hendrik Haase
3a6baf0f12 Add CHANGELOG entry for retry feature 2023-02-21 15:08:59 +01:00
Sven-Hendrik Haase
e8c797e08e Merge pull request #96 from sonphantrung/retry-v2
Add retry to upload release (UPDATED VERSION)
2023-02-21 15:07:45 +01:00
Son Phan Trung
cf83be2c7f Merge branch 'master' into retry-v2 2023-02-21 20:08:09 +07:00
Son Phan Trung
cfdd9b50bd Merge branch 'retry' of https://github.com/messense/upload-release-action 2023-02-21 20:06:34 +07:00
Sven-Hendrik Haase
cc92c9093e 2.4.1 2023-02-01 23:55:13 +01:00
Sven-Hendrik Haase
72f6bf584a Merge pull request #93 from ggreif/gabor/fix
Fix uploading of assets
2023-01-31 22:49:36 +01:00
Gabor Greif
f2899b4677 use createReadStream 2023-01-31 20:27:15 +01:00
Gabor Greif
af306bddfe Revert "use the @file mechanism of octokit-5"
This reverts commit e5e4b800aa.
2023-01-31 20:23:19 +01:00
Sven-Hendrik Haase
9927d3f5ec Merge pull request #92 from ggreif/patch-2
Use the `@file` mechanism of octokit-5
2023-01-31 11:51:05 +01:00
Gabor Greif
e5e4b800aa use the @file mechanism of octokit-5 2023-01-28 22:34:53 +01:00
Sven-Hendrik Haase
74f6bde645 Merge pull request #91 from ggreif/gabor/subst
transform back substituted characters
2023-01-21 10:51:05 +01:00
Gabor Greif
0e6c75888a move percent recovery to the last step 2023-01-20 14:40:32 +01:00
Gabor Greif
5cbce4f5ee do the transpilation 2023-01-20 03:39:20 +01:00
Gabor Greif
df11ebfac2 test % too 2023-01-19 15:19:07 +01:00
Gabor Greif
50a5b0990c also lowercase 2023-01-19 15:15:10 +01:00
Gabor Greif
0e0bd99213 first attemt to transform back substituted characters 2023-01-19 15:07:12 +01:00
Sven-Hendrik Haase
8250434419 Update to newer Octokit 2023-01-19 13:02:09 +01:00
Sven-Hendrik Haase
9093186278 Merge pull request #90 from ggreif/patch-1
Test a two-liner body
2023-01-19 11:42:10 +01:00
Sven-Hendrik Haase
321f000b6d Go back to glob v7
It seems like glob v8 is broken on Windows for some reason.
No time to investigate this now.
2023-01-19 11:39:06 +01:00
Gabor Greif
233ab9a35e bump 2023-01-18 23:43:37 +01:00
Gabor Greif
d3a6c14a79 check for multi-line too 2023-01-18 23:40:07 +01:00
Gabor Greif
fa5d5d5a33 test a two-liner 2023-01-18 23:33:57 +01:00
Sven-Hendrik Haase
442eb645ce Merge pull request #89 from shawaj/patch-1
fix: updated readme to reflect updated version
2023-01-09 10:41:10 +01:00
Aaron Shaw
4d1e10f6d1 Update README.md 2023-01-09 02:24:13 +00:00
Aaron Shaw
f63a22975a Update README.md 2023-01-09 02:13:15 +00:00
Aaron Shaw
a9842f0f62 fix: updated readme to reflect updated version
Relates-to: #85
2023-01-09 02:08:24 +00:00
Sven-Hendrik Haase
2728235f7d 2.4.0 2023-01-09 02:49:49 +01:00
Sven-Hendrik Haase
c2e0608dc4 Merge pull request #88 from svenstaro/dependabot/npm_and_yarn/json5-1.0.2
Bump json5 from 1.0.1 to 1.0.2
2023-01-03 22:48:34 +01:00
Sven-Hendrik Haase
bd74772a1a Don't shadow vars 2023-01-03 22:45:08 +01:00
dependabot[bot]
16e7903b2d Bump json5 from 1.0.1 to 1.0.2
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-03 21:38:30 +00:00
Sven-Hendrik Haase
f2c549b117 Bump some more deps 2023-01-03 22:31:31 +01:00
Sven-Hendrik Haase
7a7d004438 Bump some deps 2023-01-03 22:27:35 +01:00
Sven-Hendrik Haase
9c4a92ec0d Use explicit any 2023-01-03 22:20:36 +01:00
Sven-Hendrik Haase
039214a996 Bump jest and typescript versions 2023-01-03 22:13:40 +01:00
Sven-Hendrik Haase
2b373356cb Update to node16 2023-01-03 22:09:30 +01:00
messense
1819382cf9 Add retry to upload release 2022-07-03 11:23:10 +08:00
Sven-Hendrik Haase
fb1eb39e74 Merge pull request #75 from svenstaro/dependabot/npm_and_yarn/jsdom-16.7.0
Bump jsdom from 16.4.0 to 16.7.0
2022-06-23 12:06:33 +02:00
dependabot[bot]
7786b24bd8 Bump jsdom from 16.4.0 to 16.7.0
Bumps [jsdom](https://github.com/jsdom/jsdom) from 16.4.0 to 16.7.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/16.4.0...16.7.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-23 10:01:32 +00:00
Sven-Hendrik Haase
133984371c 2.3.0 2022-06-05 19:04:28 +02:00
Sven-Hendrik Haase
c2b649c57e Merge pull request #72 from svenstaro/dependabot/npm_and_yarn/node-fetch-2.6.7
Bump node-fetch from 2.6.1 to 2.6.7
2022-05-28 07:07:29 +02:00
Sven-Hendrik Haase
eb625cd0ad Merge pull request #71 from svenstaro/dependabot/npm_and_yarn/ansi-regex-4.1.1
Bump ansi-regex from 4.1.0 to 4.1.1
2022-05-28 07:07:19 +02:00
dependabot[bot]
99cbd251b2 Bump node-fetch from 2.6.1 to 2.6.7
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-28 05:05:58 +00:00
dependabot[bot]
a6824c9e54 Bump ansi-regex from 4.1.0 to 4.1.1
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-28 05:05:57 +00:00
Sven-Hendrik Haase
6eb74c809d Merge pull request #67 from svenstaro/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-05-28 07:05:23 +02:00
Sven-Hendrik Haase
8ec375d911 Merge pull request #69 from leighmcculloch/patch-1
Add defaults to commonly set fields to reduce setup
2022-05-28 07:04:25 +02:00
Leigh McCulloch
8d45355ac2 Update README.md 2022-04-04 00:56:40 -07:00
Leigh McCulloch
7d269bd712 Add defaults to commonly set fields to reduce setup 2022-04-04 00:54:54 -07:00
dependabot[bot]
c71fb95114 Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-24 13:12:37 +00:00
Sven-Hendrik Haase
1d71c233f7 Merge pull request #47 from svenstaro/dependabot/npm_and_yarn/y18n-4.0.1
Bump y18n from 4.0.0 to 4.0.1
2021-11-18 06:45:47 +01:00
Sven-Hendrik Haase
78ec101a88 Merge pull request #58 from svenstaro/dependabot/npm_and_yarn/tmpl-1.0.5
Bump tmpl from 1.0.4 to 1.0.5
2021-11-18 06:45:36 +01:00
dependabot[bot]
d8cafc3c87 Bump tmpl from 1.0.4 to 1.0.5
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-21 12:11:16 +00:00
Sven-Hendrik Haase
a70d06e688 Merge pull request #55 from svenstaro/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2021-08-24 05:10:49 +02:00
dependabot[bot]
072f986a7c Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-11 09:35:24 +00:00
Sven-Hendrik Haase
2f88c7710e Merge pull request #53 from svenstaro/dependabot/npm_and_yarn/glob-parent-5.1.2
Bump glob-parent from 5.1.1 to 5.1.2
2021-06-13 08:08:56 +02:00
dependabot[bot]
ee200cfabc Bump glob-parent from 5.1.1 to 5.1.2
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-11 23:29:23 +00:00
Sven-Hendrik Haase
82b6f4a2ea Merge pull request #52 from svenstaro/dependabot/npm_and_yarn/ws-7.4.6
Bump ws from 7.3.1 to 7.4.6
2021-05-29 19:55:57 +02:00
dependabot[bot]
3f585610ac Bump ws from 7.3.1 to 7.4.6
Bumps [ws](https://github.com/websockets/ws) from 7.3.1 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.3.1...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-29 13:48:38 +00:00
Sven-Hendrik Haase
61a0748878 Merge pull request #51 from svenstaro/dependabot/npm_and_yarn/hosted-git-info-2.8.9
Bump hosted-git-info from 2.8.8 to 2.8.9
2021-05-10 23:51:40 +02:00
dependabot[bot]
743e8a90bd Bump hosted-git-info from 2.8.8 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 21:23:58 +00:00
Sven-Hendrik Haase
15ebdecb60 Merge pull request #50 from svenstaro/dependabot/npm_and_yarn/lodash-4.17.21
Bump lodash from 4.17.19 to 4.17.21
2021-05-10 23:23:15 +02:00
dependabot[bot]
57649ec774 Bump lodash from 4.17.19 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 09:07:37 +00:00
Sven-Hendrik Haase
f9dffdf5a6 Merge pull request #49 from pranjal-joshi/docs-update
Example added for feeding a file to the body tag
2021-05-02 07:48:42 +02:00
Pranjal Joshi
71756ac6ec Example added for feeding a file to the body tag 2021-05-02 10:28:27 +05:30
Pranjal Joshi
2b6c678b07 Example added for feeding file to body tag 2021-05-02 10:24:18 +05:30
dependabot[bot]
a95c4e7c33 Bump y18n from 4.0.0 to 4.0.1
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-30 23:00:12 +00:00
Sven-Hendrik Haase
4e5de20777 Merge pull request #40 from svenstaro/dependabot/npm_and_yarn/node-notifier-8.0.1
Bump node-notifier from 8.0.0 to 8.0.1
2020-12-22 10:40:51 +01:00
dependabot[bot]
3f38d56a41 Bump node-notifier from 8.0.0 to 8.0.1
Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/mikaelbr/node-notifier/releases)
- [Changelog](https://github.com/mikaelbr/node-notifier/blob/v8.0.1/CHANGELOG.md)
- [Commits](https://github.com/mikaelbr/node-notifier/compare/v8.0.0...v8.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-22 08:20:52 +00:00
Sven-Hendrik Haase
483c1e56f9 This is 2.2.1 2020-12-16 05:19:13 +01:00
Sven-Hendrik Haase
1899a6bd0d Merge pull request #36 from djpohly/paginate-assets
Use octokit.paginate to get all release assets
2020-12-16 05:12:32 +01:00
Devin J. Pohly
bf76499b98 Use octokit.paginate to get all release assets
Fixes #35, in which assets not on the first page would not be detected
and deleted when trying to overwrite, resulting in an "already_exists"
error.
2020-12-02 16:25:13 -06:00
Sven-Hendrik Haase
e74ff71f7d Prepare 2.2.0 2020-10-07 18:46:11 +02:00
Sven-Hendrik Haase
697a9f190e Merge pull request #25 from kittaakos/GH-24--custom-owner-repo
GH-24: Support for creating a new GH release in a foreign repository.
2020-10-07 18:41:33 +02:00
Akos Kitta
011f7957ff GH-24: Support for custom owner/repo config.
To be able to manage foreign repositories.
The `owner` and `repo` is extracted from the `repo_name`.
Otherwise, it uses the current repository.

Closes #24

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
2020-10-05 15:33:05 +02:00
Sven-Hendrik Haase
4f71b6d30b Merge pull request #31 from svenstaro/dependabot/npm_and_yarn/actions/core-1.2.6
Bump @actions/core from 1.2.4 to 1.2.6
2020-10-01 19:24:21 +02:00
dependabot[bot]
24b1cacbb1 Bump @actions/core from 1.2.4 to 1.2.6
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.4 to 1.2.6.
- [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[bot] <support@github.com>
2020-10-01 17:17:42 +00:00
Sven-Hendrik Haase
4ce0a13e83 This is 2.1.1 2020-09-25 05:40:59 +02:00
Sven-Hendrik Haase
6ca3eb1422 Add CHANGELOG entry for 2.1.1 2020-09-25 05:40:29 +02:00
Sven-Hendrik Haase
54a6699008 Merge pull request #27 from kittaakos/GH-26
GH-26: Fixed ignored `release_name` option.
2020-09-25 05:18:30 +02:00
Sven-Hendrik Haase
afb12c9a16 Merge pull request #29 from svenstaro/dependabot/npm_and_yarn/node-fetch-2.6.1
Bump node-fetch from 2.6.0 to 2.6.1
2020-09-12 15:18:12 +02:00
dependabot[bot]
89767936cf Bump node-fetch from 2.6.0 to 2.6.1
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [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[bot] <support@github.com>
2020-09-12 07:26:42 +00:00
Akos Kitta
d3d2e8da76 GH-26: Fixed ignored release_name option.
`name` should be used when creating a new release.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
2020-09-02 16:57:09 +02:00
Sven-Hendrik Haase
ec0ba8651f 2.1.0 2020-08-10 05:21:17 +02:00
Sven-Hendrik Haase
0d3c327d15 Merge pull request #23 from OmarEmaraDev/strip-refs-heads
Strip refs/heads/ from the input tag.
2020-08-10 05:02:21 +02:00
Omar Emara
24dc1f0ef1 Update the description of the tag input. 2020-08-07 17:02:07 +02:00
Omar Emara
94502fe175 Strip refs/heads/ from the input tag.
This patch strips refs/heads/ from the input tag to make it easier to
use the action with pushes on branches.
2020-08-05 18:54:20 +02:00
Sven-Hendrik Haase
2f92806c5d Merge pull request #21 from svenstaro/dependabot/npm_and_yarn/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19
2020-07-23 20:58:26 +02:00
dependabot[bot]
d715678c11 Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-18 01:49:53 +00:00
Sven-Hendrik Haase
3735b5ec52 Fix typos 2020-07-03 10:29:57 +02:00
Sven-Hendrik Haase
17fcb1df4f Fix last commit 2 2020-07-03 10:29:30 +02:00
Sven-Hendrik Haase
47b74e816a Fix last commit 2020-07-03 10:27:31 +02:00
Sven-Hendrik Haase
a9a904a8a4 Make sure parallel CI runs can't interfere 2020-07-03 10:24:43 +02:00
Sven-Hendrik Haase
49404e33ce Run versioning flow on ubuntu-latest 2020-07-03 10:22:24 +02:00
Sven-Hendrik Haase
c5cd3d711a Fix call to versioning flow 2020-07-03 10:15:15 +02:00
Sven-Hendrik Haase
f58e245343 Update README examples for new version 2020-07-03 10:12:47 +02:00
Sven-Hendrik Haase
1daf68639d Remove draft functionality as GitHub can't have tagged draft releases sadly 2020-07-03 10:06:50 +02:00
Sven-Hendrik Haase
3c84140b3e Document draft 2020-07-03 09:57:25 +02:00
Sven-Hendrik Haase
fa9b523f3c Fix draft tag usage in tests 2020-07-03 09:53:50 +02:00
Sven-Hendrik Haase
6bb16de6db Add draft input parameter 2020-07-03 09:40:54 +02:00
Sven-Hendrik Haase
adacb86abb Document new changes 2020-07-03 09:32:39 +02:00
Sven-Hendrik Haase
fbd30418aa Allow for setting explicit release_name (fixes #14) 2020-07-03 09:27:14 +02:00
Sven-Hendrik Haase
588487bf09 Default asset_name to the original file name (fixes #4) 2020-07-03 09:17:13 +02:00
Sven-Hendrik Haase
c0f4101399 Prepare release 2.0.0 2020-07-03 08:57:20 +02:00
Sven-Hendrik Haase
30dfbfdd8d Properly declare new inputs and outputs 2020-07-03 08:52:30 +02:00
Sven-Hendrik Haase
806b0b0631 Add prerelease and body options 2020-07-03 08:47:23 +02:00
Sven-Hendrik Haase
fdd8502475 Try that again 2020-07-03 07:27:02 +02:00
Sven-Hendrik Haase
8277eef782 Properly delete tag 2020-07-03 07:25:57 +02:00
Sven-Hendrik Haase
fbc34f818a Clean up after tests 2020-07-03 07:24:14 +02:00
Sven-Hendrik Haase
38c90ed08f Please node 2020-07-03 07:20:21 +02:00
Sven-Hendrik Haase
c7fa458e37 More debug 2020-07-03 07:12:34 +02:00
Sven-Hendrik Haase
8c679d7487 Sigh more debug 2020-07-03 07:09:17 +02:00
Sven-Hendrik Haase
7cac809eef Fix for new octokit 2020-07-03 06:59:57 +02:00
Sven-Hendrik Haase
d082cf3f16 More debugging 2020-07-03 06:50:39 +02:00
Sven-Hendrik Haase
9afb63d9be More debugging 2020-07-03 06:42:40 +02:00
Sven-Hendrik Haase
0c20962e0b Try doing pre-releases rather 2020-07-03 06:40:23 +02:00
Sven-Hendrik Haase
bd83be724b Run curl silent 2020-07-03 06:36:05 +02:00
Sven-Hendrik Haase
5788568237 Follow curl redirect 2020-07-03 06:33:31 +02:00
Sven-Hendrik Haase
05bca815fe Better debug 2020-07-03 06:31:05 +02:00
Sven-Hendrik Haase
0faf394792 Some debug output 2020-07-03 06:24:47 +02:00
Sven-Hendrik Haase
826b119adc Try string interpolation 2020-07-03 06:23:31 +02:00
Sven-Hendrik Haase
c48071c5e8 Sigh 2020-07-03 06:21:44 +02:00
Sven-Hendrik Haase
ba09d617a8 Fix typo 2020-07-03 06:20:54 +02:00
Sven-Hendrik Haase
c14556ae27 Just use curl 2020-07-03 06:20:03 +02:00
Sven-Hendrik Haase
efda0e7412 Sigh give up and use node-fetch 2020-07-03 06:05:26 +02:00
Sven-Hendrik Haase
3e5b1a7442 We'll just keep trying 2020-07-03 05:54:56 +02:00
Sven-Hendrik Haase
5d5ed153e8 Fix delete ref 2020-07-03 05:54:12 +02:00
Sven-Hendrik Haase
d151157326 Maybe this fixes it 2020-07-03 05:53:41 +02:00
Sven-Hendrik Haase
d59b001b39 Try to download without auth headers 2020-07-03 05:43:10 +02:00
Sven-Hendrik Haase
802e00067c Try github.request again 2020-07-03 05:32:27 +02:00
Sven-Hendrik Haase
ffdc680f33 Set accept header as string 2020-07-03 05:01:28 +02:00
Sven-Hendrik Haase
48ee6952fb Set headers for download 2020-07-03 05:00:09 +02:00
Sven-Hendrik Haase
319155ea78 Fix assert 2020-07-03 04:56:26 +02:00
Sven-Hendrik Haase
ef27273521 Maybe finally fix test 2 2020-07-03 04:54:45 +02:00
Sven-Hendrik Haase
41ca44be6f Maybe finally fix test 2020-07-03 04:53:07 +02:00
Sven-Hendrik Haase
7238d4307d Fix syntax 2020-07-03 04:52:04 +02:00
Sven-Hendrik Haase
003f46c67a Try downloading this way 2020-07-03 04:49:30 +02:00
Sven-Hendrik Haase
d49eb2564a Try accessing test data properly 2020-07-03 04:40:50 +02:00
Sven-Hendrik Haase
179efc987d Await stuff 2020-07-03 04:36:43 +02:00
Sven-Hendrik Haase
6dd75691d6 Add debugging 2020-07-03 04:35:33 +02:00
Sven-Hendrik Haase
8f6457b46e Add useful test 2020-07-03 04:32:52 +02:00
Sven-Hendrik Haase
842807fcaf Generate dist.js 2020-07-03 03:53:50 +02:00
Sven-Hendrik Haase
e6466806bd Revert "Fix entrypoint in package.json"
This reverts commit 95b7f6102f.
2020-07-03 03:53:12 +02:00
Sven-Hendrik Haase
623a8a1785 Generate dist.js 2020-07-03 03:51:57 +02:00
Sven-Hendrik Haase
96917a90ee Fix renamed method in octokit/rest 2020-07-03 03:51:31 +02:00
Sven-Hendrik Haase
95b7f6102f Fix entrypoint in package.json 2020-07-03 03:50:58 +02:00
Sven-Hendrik Haase
ff946c0b57 Fix entrypoint 2020-07-03 03:36:45 +02:00
Sven-Hendrik Haase
646b122c81 Better CI flow names 2020-07-03 03:36:38 +02:00
Sven-Hendrik Haase
907e5dae80 Try to test Action in-vivo 2020-07-03 03:34:38 +02:00
Sven-Hendrik Haase
d69dec835b Better formatting in release instructions 2020-07-03 03:18:13 +02:00
Sven-Hendrik Haase
0e699b142b Rename CI Flow 2020-07-03 03:10:35 +02:00
Sven-Hendrik Haase
010fda07b6 Add notes on how to publish a new version 2020-07-03 03:09:13 +02:00
Sven-Hendrik Haase
0f446d9646 Add aut-versioning for feal this time 2020-07-03 03:02:36 +02:00
Sven-Hendrik Haase
d7e47607f7 Make examples in README a bit clearer 2020-07-03 03:02:12 +02:00
Sven-Hendrik Haase
bf98c4413f Add auto-versioning and better CI 2020-07-03 03:01:50 +02:00
Sven-Hendrik Haase
12f7fc1a8b Add stub tests 2020-07-02 09:46:02 +02:00
Sven-Hendrik Haase
08e809b7ae Add tons of Typescript strictness 2020-07-02 09:43:38 +02:00
Sven-Hendrik Haase
371a3bf0be Format code 2020-07-02 07:56:14 +02:00
Sven-Hendrik Haase
f4d050cb90 Update deps 2020-07-02 07:55:34 +02:00
Sven-Hendrik Haase
b8902a20c8 Delete old files 2020-07-02 07:38:13 +02:00
Sven-Hendrik Haase
5f836e8716 Correct typo 2020-07-02 07:32:20 +02:00
Alex Jurkiewicz
223b39fc7a Support $tag substitution in asset names 2020-07-02 07:31:13 +02:00
Alex Jurkiewicz
c571424387 Correct workflow instructions 2020-07-02 07:30:57 +02:00
Sven-Hendrik Haase
a09c67074f Finish syncing with upstream 2020-07-02 07:03:27 +02:00
Sven-Hendrik Haase
11f6e3b5af Start syncing with upstream actions/typescript-action 2020-07-02 07:03:27 +02:00
Sven-Hendrik Haase
1d082de854 Create FUNDING.yml 2020-07-02 06:42:41 +02:00
Sven-Hendrik Haase
387cfa6016 Merge pull request #12 from Pzixel/patch-1
Fix failing CI
2020-04-07 11:09:18 +02:00
Psilon
aa32ea81b6 Update README.md 2020-03-26 12:43:07 +03:00
Sven-Hendrik Haase
48b3121e13 Merge pull request #10 from svenstaro/dependabot/npm_and_yarn/acorn-5.7.4
Bump acorn from 5.7.3 to 5.7.4
2020-03-16 13:57:00 +01:00
dependabot[bot]
55755cd0bc Bump acorn from 5.7.3 to 5.7.4
Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-16 11:51:41 +00:00
Sven-Hendrik Haase
7a362f7ad8 Merge pull request #6 from sandiz/file_glob_support
File glob support
2019-12-12 06:17:43 +01:00
Sandi Chakravarty
57f48797a8 convert to iterator 2019-10-23 21:18:30 -07:00
Sandi Chakravarty
79426d2a8c update README with pr suggestions 2019-10-09 11:40:46 -07:00
Sandi Chakravarty
056edc7bfb update README with file_glob instructions 2019-10-08 14:13:21 -07:00
Sandi Chakravarty
cb3a639a0c add support for file_glob 2019-10-08 14:12:02 -07:00
Sven-Hendrik Haase
add30524b0 Compile JS 2019-09-04 23:03:10 +02:00
Sven-Hendrik Haase
263c60b870 We don't actually need the types 2019-09-04 23:00:39 +02:00
Sven-Hendrik Haase
dba641ace8 Update deps and set version to 1.0.1 2019-09-04 22:50:03 +02:00
Sven-Hendrik Haase
13aa539342 Fix README some more 2019-09-04 22:44:35 +02:00
Sven-Hendrik Haase
05f38782c2 Update README 2019-09-04 22:42:31 +02:00
Sven-Hendrik Haase
8db4b1ff15 Fix markup 2019-09-04 22:40:22 +02:00
Sven-Hendrik Haase
1eabee8e81 Sync changes 2019-09-04 14:27:03 +02:00
Sven-Hendrik Haase
8eb6a035aa Change the way we parse refs 2019-09-04 13:48:18 +02:00
Sven-Hendrik Haase
8d9569a6a5 Add badge link to workflow 2019-08-24 03:30:21 +02:00
Sven-Hendrik Haase
778bbb1861 Add badge 2019-08-24 01:47:34 +02:00
Sven-Hendrik Haase
a27f407069 Add forgotten line to complex example 2019-08-23 06:07:52 +02:00
Sven-Hendrik Haase
44bfc8c770 Fix grammar 2019-08-23 05:49:27 +02:00
Sven-Hendrik Haase
21ef0e0838 Fix README syntax 2019-08-23 04:44:19 +02:00
20 changed files with 19839 additions and 5178 deletions

3
.eslintignore Normal file
View File

@@ -0,0 +1,3 @@
dist/
lib/
node_modules/

54
.eslintrc.json Normal file
View File

@@ -0,0 +1,54 @@
{
"plugins": ["jest", "@typescript-eslint", "github"],
"extends": ["plugin:github/typescript"],
"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/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-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
}
}

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

@@ -0,0 +1 @@
github: svenstaro

View File

@@ -1,25 +0,0 @@
name: "PR Checks"
on: [pull_request, push]
jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "npm ci"
run: npm ci
- name: "npm run build"
run: npm run build
- name: "npm run test"
run: npm run test
- 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 format'" \
"and check in all changes" \
&& exit 1)

71
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: "CI"
on: [pull_request, push]
jobs:
build: # make sure build/ci work properly
name: CI on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- run: |
npm install
npm run all
test: # make sure the action works on a clean machine without building
name: E2E test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Make test pre-release
uses: ./
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: README.md
asset_name: TEST.md
tag: ci-test-${{ matrix.os }}-${{ github.run_id }}
overwrite: true
prerelease: true
body: "rofl lol test%0Aianal %25 fubar"
- name: Check that the uploaded asset is readable
uses: actions/github-script@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs')
const child_process = require('child_process');
const assert = require('assert').strict;
const expected = fs.readFileSync("README.md")
const release = await github.repos.getReleaseByTag({
...context.repo,
tag: "ci-test-${{ matrix.os }}-${{ github.run_id }}",
})
assert.deepStrictEqual(release.data.prerelease, true)
assert.deepStrictEqual(release.data.body, "rofl lol test\nianal % fubar")
assert.deepStrictEqual(release.data.assets[0].name, "TEST.md")
const actual = child_process.execSync(`curl -Ls ${release.data.assets[0].browser_download_url}`)
assert.deepStrictEqual(expected, actual)
- name: Clean up
if: ${{ always() }}
uses: actions/github-script@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const release = await github.repos.getReleaseByTag({
...context.repo,
tag: "ci-test-${{ matrix.os }}-${{ github.run_id }}",
})
await github.repos.deleteRelease({
...context.repo,
release_id: release.data.id,
})
await github.git.deleteRef({
...context.repo,
ref: "tags/ci-test-${{ matrix.os }}-${{ github.run_id }}",
})

15
.github/workflows/versioning.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Keep the versions up-to-date
on:
release:
types: [published, edited]
jobs:
actions-tagger:
runs-on: ubuntu-latest
steps:
- uses: Actions-R-Us/actions-tagger@latest
env:
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
with:
publish_latest_tag: true

5
.gitignore vendored
View File

@@ -1,3 +1,4 @@
node_modules/ node_modules
__tests__/runner/*
run.sh run.sh
__tests__/runner/*
lib/**/*

3
.prettierignore Normal file
View File

@@ -0,0 +1,3 @@
dist/
lib/
node_modules/

11
.prettierrc.json Normal file
View File

@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}

34
CHANGELOG.md Normal file
View File

@@ -0,0 +1,34 @@
# Changelog
## [2.5.0] - 2023-02-21
- Add retry to upload release [#96](https://github.com/svenstaro/upload-release-action/pull/96) (thanks @sonphantrung)
## [2.4.1] - 2023-02-01
- Modernize octokit usage
## [2.4.0] - 2023-01-09
- Update to node 16
- Bump most dependencies
## [2.3.0] - 2022-06-05
- Now defaults `repo_token` to `${{ github.token }}` and `tag` to `${{ github.ref }}` [#69](https://github.com/svenstaro/upload-release-action/pull/69) (thanks @leighmcculloch)
## [2.2.1] - 2020-12-16
- Added support for the GitHub pagination API for repositories with many releases [#36](https://github.com/svenstaro/upload-release-action/pull/36) (thanks @djpohly)
## [2.2.0] - 2020-10-07
- Add support for ceating a new release in a foreign repository [#25](https://github.com/svenstaro/upload-release-action/pull/25) (thanks @kittaakos)
- Upgrade all deps
## [2.1.1] - 2020-09-25
- Fix `release_name` option [#27](https://github.com/svenstaro/upload-release-action/pull/27) (thanks @kittaakos)
## [2.1.0] - 2020-08-10
- Strip refs/heads/ from the input tag [#23](https://github.com/svenstaro/upload-release-action/pull/23) (thanks @OmarEmaraDev)
## [2.0.0] - 2020-07-03
- Add `prerelease` input parameter. Setting this marks the created release as a pre-release.
- Add `release_name` input parameter. Setting this explicitly sets the title of the release.
- Add `body` input parameter. Setting this sets the text content of the created release.
- Add `browser_download_url` output variable. This contains the publicly accessible download URL of the uploaded artifact.
- Allow for leaving `asset_name` unset. This will cause the asset to use the filename.

171
README.md
View File

@@ -1,17 +1,30 @@
# Upload files to a GitHub release # Upload files to a GitHub release [![GitHub Actions Workflow](https://github.com/svenstaro/upload-release-action/actions/workflows/ci.yml/badge.svg)](https://github.com/svenstaro/upload-release-action/actions)
This action allows you to select which files to upload to the just-tagged release. This action allows you to select which files to upload to the just-tagged release.
It runs on all operating systems types offered by GitHub. It runs on all operating systems types offered by GitHub.
## Input variables: ## Input variables
You must provide: You must provide:
- `repo_token`: Usually you'll want to set this to `${{ secrets.GITHUB_TOKEN }}`
- `file`: A local file to be uploaded as the asset. - `file`: A local file to be uploaded as the asset.
- `asset_name`: The name the file gets as an asset on a release.
- `tag`: The tag to uploaded into. If you want the current event's tag, use `${{ github.event.ref }}` Optional Arguments
- `overwrite`: If an asset with name already exists, overwrite it.
- `repo_token`: Defaults to `github.token`.
- `tag`: The tag to upload into. If you want the current event's tag or branch name, use `${{ github.ref }}` (the `refs/tags/` and `refs/heads/` prefixes will be automatically stripped). Defaults to `github.ref`.
- `asset_name`: The name the file gets as an asset on a release. Use `$tag` to include the tag name. When not provided it will default to the filename.
This is not used if `file_glob` is set to `true`.
- `file_glob`: If set to true, the file argument can be a glob pattern (`asset_name` is ignored in this case) (Default: `false`)
- `overwrite`: If an asset with the same name already exists, overwrite it (Default: `false`).
- `prerelease`: Mark the release as a pre-release (Default: `false`).
- `release_name`: Explicitly set a release name. (Defaults: implicitly same as `tag` via GitHub API).
- `body`: Content of the release text (Default: `""`).
- `repo_name`: Specify the name of the GitHub repository in which the GitHub release will be created, edited, and deleted. If the repository is other than the current, it is required to create a personal access token with `repo`, `user`, `admin:repo_hook` scopes to the foreign repository and add it as a secret. (Default: current repository).
## Output variables
- `browser_download_url`: The publicly available URL of the asset.
## Usage ## Usage
@@ -24,8 +37,9 @@ Simple example:
name: Publish name: Publish
on: on:
create: push:
tags: tags:
- '*'
jobs: jobs:
build: build:
@@ -33,20 +47,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: hecrj/setup-rust-action@v1-release - uses: actions/checkout@v3
with:
rust-version: stable
- uses: actions/checkout@v1
- name: Build - name: Build
run: cargo build --release run: cargo build --release
- name: Upload binaries to release - name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/mything file: target/release/mything
asset_name: mything asset_name: mything
tag: {{ github.event.ref }} tag: ${{ github.ref }}
overwrite: true overwrite: true
body: "This is my release text"
``` ```
Complex example with more operating systems: Complex example with more operating systems:
@@ -55,11 +67,12 @@ Complex example with more operating systems:
name: Publish name: Publish
on: on:
create: push:
tags: tags:
- '*'
jobs: jobs:
build: publish:
name: Publish for ${{ matrix.os }} name: Publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
@@ -76,16 +89,132 @@ jobs:
asset_name: mything-macos-amd64 asset_name: mything-macos-amd64
steps: steps:
- uses: hecrj/setup-rust-action@v1-release - uses: actions/checkout@v3
with:
rust-version: stable
- uses: actions/checkout@v1
- name: Build - name: Build
run: cargo build --release run: cargo build --release --locked
- name: Upload binaries to release - name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }} file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }} asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}
``` ```
Example with `file_glob`:
```yaml
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
name: Publish binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/my*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
```
Example for creating a release in a foreign repository using `repo_name`:
```yaml
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
name: Publish binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_name: owner/repository-name
# A personal access token for the GitHub repository in which the release will be created and edited.
# It is recommended to create the access token with the following scopes: `repo, user, admin:repo_hook`.
repo_token: ${{ secrets.YOUR_PERSONAL_ACCESS_TOKEN }}
file: target/release/mything
asset_name: mything
tag: ${{ github.ref }}
overwrite: true
body: "This is my release text"
```
**Example for feeding a file from repo to the `body` tag:**
This example covers following points:
* Reading a file present on the repo. For example, `release.md` which is placed in root directory of the repo.
* Modify & push the `release.md` file before triggering this action (create tag for this example) to dynamically change the body of the release.
```yaml
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
name: Publish binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# This step reads a file from repo and use it for body of the release
# This works on any self-hosted runner OS
- name: Read release.md and use it as a body of new release
id: read_release
shell: bash
run: |
r=$(cat path/to/release.md) # <--- Read release.md (Provide correct path as per your repo)
r="${r//'%'/'%25'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT # <--- Set environment variable
- name: Upload Binaries to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
body: |
${{ steps.read_release.outputs.RELEASE_BODY }} # <--- Use environment variables that was created earlier
```
## Releasing
To release this Action:
- Bump version in `package.json`
- Create `CHANGELOG.md` entry
- `npm run all`
- `git commit -am <version>`
- `git tag -sm <version> <version>`
- `git push --follow-tags`
- Go to https://github.com/svenstaro/upload-release-action/releases and publish the new version

View File

@@ -1,6 +1,25 @@
import * as main from '../src/main'; import * as github from '@actions/github'
import * as main from '../src/main'
// Frankly, tests would be entirely useless unless we can mock GitHub somehow. // Frankly, tests would be entirely useless unless we can mock GitHub somehow.
describe('Upload Release Action', () => { describe('Upload Release Action', () => {
it('', async () => {}); let spyGetOctokit: jest.SpyInstance<any>
}); let mockOctokit: any
beforeEach(() => {
mockOctokit = {
repos: {
createRelease: jest.fn(async () => ({
data: {
id: 'lalala',
upload_url: 'oaoa'
}
}))
}
}
// spyGetOctokit = jest.spyOn(github, "getOctokit").mockImplementation(() => mockOctokit
// jest.spyOn(github, "context", "get").mockImplementation(() => "testtest");
})
it('pls write actual test', async () => {})
})

View File

@@ -6,19 +6,33 @@ branding:
color: orange color: orange
inputs: inputs:
repo_token: repo_token:
description: 'GitHub token' description: 'GitHub token.'
required: true required: true
default: ${{ github.token }}
file: file:
description: 'Local file to upload' description: 'Local file to upload.'
required: true
asset_name:
description: 'Name of the asset'
required: true required: true
tag: tag:
description: 'Tag to use as a release' description: 'Tag to use as a release.'
required: true required: true
default: ${{ github.ref }}
asset_name:
description: 'Name of the asset. When not provided will use the file name. Unused if file_glob is set to "true".'
overwrite: overwrite:
description: 'Overwrite the release in case it already exists' description: 'Overwrite the release in case it already exists.'
file_glob:
description: 'If true the file can be a glob pattern, asset_name is ignored if this is true.'
prerelease:
description: 'Mark the release as a pre-release. Defaults to "false".'
release_name:
description: 'Explicitly set a release name. Defaults to empty which will cause the release to take the tag as name on GitHub.'
body:
description: 'Content of the release text. Empty by default.'
repo_name:
description: 'Specify the name of the GitHub repository in which the GitHub release will be created, edited, and deleted. If the repository is other than the current, it is required to create a personal access token with `repo`, `user`, `admin:repo_hook` scopes to the foreign repository and add it as a secret. Defaults to the current repository'
outputs:
browser_download_url:
description: 'The publicly available URL of the asset.'
runs: runs:
using: 'node12' using: 'node16'
main: 'lib/main.js' main: 'dist/index.js'

13428
dist/index.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +0,0 @@
# Contributors
### Checkin
- Do checkin source (src)
- Do checkin build output (lib)
- Do checkin runtime node_modules
- Do not checkin devDependency node_modules (husky can help see below)
### devDependencies
In order to handle correctly checking in node_modules without devDependencies, we run [Husky](https://github.com/typicode/husky) before each commit.
This step ensures that formatting and checkin rules are followed and that devDependencies are excluded. To make sure Husky runs correctly, please use the following workflow:
```
npm install # installs all devDependencies including Husky
git add abc.ext # Add the files you've changed. This should include files in src, lib, and node_modules (see above)
git commit -m "Informative commit message" # Commit. This will run Husky
```
During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier) as well as pruning out devDependencies using `npm prune --production`.
It will also make sure these changes are appropriately included in your commit (no further work is needed)

View File

@@ -1,92 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
const core = __importStar(require("@actions/core"));
const github = __importStar(require("@actions/github"));
function get_release_by_tag(tag, octokit, context) {
return __awaiter(this, void 0, void 0, function* () {
try {
core.debug(`Getting release by tag ${tag}.`);
return yield octokit.repos.getReleaseByTag(Object.assign({}, context.repo, { tag: tag }));
}
catch (error) {
// If this returns 404, we need to create the release first.
if (error.status === 404) {
core.debug(`Release for tag ${tag} doesn't exist yet so we'll create it now.`);
return yield octokit.repos.createRelease(Object.assign({}, context.repo, { tag_name: tag }));
}
else {
throw error;
}
}
});
}
function upload_to_release(release, file, asset_name, tag, overwrite, octokit, context) {
return __awaiter(this, void 0, void 0, function* () {
const file_size = fs.statSync(file).size;
const file_bytes = fs.readFileSync(file);
// Check for duplicates.
const assets = yield octokit.repos.listAssetsForRelease(Object.assign({}, context.repo, { release_id: release.data.id }));
const duplicate_asset = assets.data.find(a => a.name === asset_name);
if (duplicate_asset !== undefined) {
if (overwrite === "true") {
core.debug(`An asset called ${asset_name} already exists in release ${tag} so we'll overwrite it.`);
yield octokit.repos.deleteReleaseAsset(Object.assign({}, context.repo, { asset_id: duplicate_asset.id }));
}
else {
core.setFailed(`An asset called ${asset_name} already exists.`);
return;
}
}
else {
core.debug(`No pre-existing asset called ${asset_name} found in release ${tag}. All good.`);
}
core.debug(`Uploading ${file} to ${asset_name} in release ${tag}.`);
yield octokit.repos.uploadReleaseAsset({
url: release.data.upload_url,
name: asset_name,
file: file_bytes,
headers: {
"content-type": "binary/octet-stream",
"content-length": file_size
},
});
});
}
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const token = core.getInput('repo_token', { required: true });
const file = core.getInput('file', { required: true });
const asset_name = core.getInput('asset_name', { required: true });
const tag = core.getInput('tag', { required: true });
const overwrite = core.getInput('overwrite');
if (!fs.existsSync(file)) {
core.setFailed(`File ${file} wasn't found.`);
}
const octokit = new github.GitHub(token);
const context = github.context;
const release = yield get_release_by_tag(tag, octokit, context);
yield upload_to_release(release, file, asset_name, tag, overwrite, octokit, context);
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();

10664
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,17 @@
{ {
"name": "upload-release-action", "name": "upload-release-action",
"version": "1.0.0", "version": "2.5.0",
"private": true, "private": true,
"description": "Upload files to a GitHub release", "description": "Upload files to a GitHub release",
"main": "lib/main.js", "main": "lib/main.js",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"test": "jest" "format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"pack": "ncc build",
"test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run pack && npm test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -22,15 +27,25 @@
"author": "Sven-Hendrik Haase", "author": "Sven-Hendrik Haase",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.0.0", "@actions/core": "^1.10.0",
"@actions/github": "^1.0.0" "@actions/github": "^5",
"@lifeomic/attempt": "^3.0.3",
"glob": "^7"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^24.0.13", "@types/glob": "^7",
"@types/node": "^12.0.4", "@types/jest": "^29",
"jest": "^24.8.0", "@types/node": "^16",
"jest-circus": "^24.7.1", "@typescript-eslint/parser": "^5",
"ts-jest": "^24.0.2", "@vercel/ncc": "^0.36.0",
"typescript": "^3.5.1" "eslint": "^8",
"eslint-plugin-github": "^4.6",
"eslint-plugin-jest": "^27",
"jest": "^29",
"jest-circus": "^29",
"js-yaml": "^4",
"prettier": "^2.8",
"ts-jest": "^29",
"typescript": "^4"
} }
} }

View File

@@ -1,85 +1,206 @@
import * as fs from 'fs'; import * as fs from 'fs'
import * as core from '@actions/core'; import {Octokit} from '@octokit/core'
import * as github from '@actions/github'; import {Endpoints} from '@octokit/types'
import * as core from '@actions/core'
import * as github from '@actions/github'
import * as path from 'path'
import * as glob from 'glob'
import {retry} from '@lifeomic/attempt'
async function get_release_by_tag(tag: string, octokit: any, context: any): Promise<any> { const releaseByTag = 'GET /repos/{owner}/{repo}/releases/tags/{tag}' as const
try { const createRelease = 'POST /repos/{owner}/{repo}/releases' as const
core.debug(`Getting release by tag ${tag}.`); const repoAssets =
return await octokit.repos.getReleaseByTag({ 'GET /repos/{owner}/{repo}/releases/{release_id}/assets' as const
...context.repo, const uploadAssets =
tag: tag, 'POST {origin}/repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}' as const
}); const deleteAssets =
} catch (error) { 'DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}' as const
// If this returns 404, we need to create the release first.
if (error.status === 404) { type ReleaseByTagResp = Endpoints[typeof releaseByTag]['response']
core.debug(`Release for tag ${tag} doesn't exist yet so we'll create it now.`) type CreateReleaseResp = Endpoints[typeof createRelease]['response']
return await octokit.repos.createRelease({ type RepoAssetsResp = Endpoints[typeof repoAssets]['response']['data']
...context.repo, type UploadAssetResp = Endpoints[typeof uploadAssets]['response']
tag_name: tag,
}) async function get_release_by_tag(
} else { tag: string,
throw error; prerelease: boolean,
} release_name: string,
body: string,
octokit: Octokit
): Promise<ReleaseByTagResp | CreateReleaseResp> {
try {
core.debug(`Getting release by tag ${tag}.`)
return await octokit.request(releaseByTag, {
...repo(),
tag: tag
})
} catch (error: any) {
// If this returns 404, we need to create the release first.
if (error.status === 404) {
core.debug(
`Release for tag ${tag} doesn't exist yet so we'll create it now.`
)
return await octokit.request(createRelease, {
...repo(),
tag_name: tag,
prerelease: prerelease,
name: release_name,
body: body
})
} else {
throw error
} }
}
} }
async function upload_to_release(release: any, file: string, asset_name: string, tag: string, overwrite: string, octokit: any, context: any) { async function upload_to_release(
const file_size = fs.statSync(file).size; release: ReleaseByTagResp | CreateReleaseResp,
const file_bytes = fs.readFileSync(file); file: string,
asset_name: string,
tag: string,
overwrite: boolean,
octokit: ReturnType<(typeof github)['getOctokit']>
): Promise<undefined | string> {
const stat = fs.statSync(file)
if (!stat.isFile()) {
core.debug(`Skipping ${file}, since its not a file`)
return
}
const file_size = stat.size
const file_bytes: any = fs.createReadStream(file)
// Check for duplicates. // Check for duplicates.
const assets = await octokit.repos.listAssetsForRelease({ const assets: RepoAssetsResp = await octokit.paginate(repoAssets, {
...context.repo, ...repo(),
release_id: release.data.id, release_id: release.data.id
}); })
const duplicate_asset = assets.data.find(a => a.name === asset_name); const duplicate_asset = assets.find(a => a.name === asset_name)
if (duplicate_asset !== undefined) { if (duplicate_asset !== undefined) {
if (overwrite === "true") { if (overwrite) {
core.debug(`An asset called ${asset_name} already exists in release ${tag} so we'll overwrite it.`) core.debug(
await octokit.repos.deleteReleaseAsset({ `An asset called ${asset_name} already exists in release ${tag} so we'll overwrite it.`
...context.repo, )
asset_id: duplicate_asset.id await octokit.request(deleteAssets, {
}) ...repo(),
} else { asset_id: duplicate_asset.id
core.setFailed(`An asset called ${asset_name} already exists.`) })
return;
}
} else { } else {
core.debug(`No pre-existing asset called ${asset_name} found in release ${tag}. All good.`); core.setFailed(`An asset called ${asset_name} already exists.`)
return duplicate_asset.browser_download_url
} }
} else {
core.debug(
`No pre-existing asset called ${asset_name} found in release ${tag}. All good.`
)
}
core.debug(`Uploading ${file} to ${asset_name} in release ${tag}.`) core.debug(`Uploading ${file} to ${asset_name} in release ${tag}.`)
await octokit.repos.uploadReleaseAsset({ const uploaded_asset: UploadAssetResp = await retry(
async () => {
return octokit.request(uploadAssets, {
...repo(),
release_id: release.data.id,
url: release.data.upload_url, url: release.data.upload_url,
name: asset_name, name: asset_name,
file: file_bytes, data: file_bytes,
headers: { headers: {
"content-type": "binary/octet-stream", 'content-type': 'binary/octet-stream',
"content-length": file_size 'content-length': file_size
},
});
}
async function run() {
try {
const token = core.getInput('repo_token', { required: true });
const file = core.getInput('file', { required: true });
const asset_name = core.getInput('asset_name', { required: true });
const tag = core.getInput('tag', { required: true });
const overwrite = core.getInput('overwrite');
if (!fs.existsSync(file)) {
core.setFailed(`File ${file} wasn't found.`);
} }
})
const octokit = new github.GitHub(token); },
const context = github.context; {
maxAttempts: 3
const release = await get_release_by_tag(tag, octokit, context);
await upload_to_release(release, file, asset_name, tag, overwrite, octokit, context);
} catch (error) {
core.setFailed(error.message);
} }
)
return uploaded_asset.data.browser_download_url
} }
run(); function repo(): {owner: string; repo: string} {
const repo_name = core.getInput('repo_name')
// If we're not targeting a foreign repository, we can just return immediately and don't have to do extra work.
if (!repo_name) {
return github.context.repo
}
const owner = repo_name.substring(0, repo_name.indexOf('/'))
if (!owner) {
throw new Error(`Could not extract 'owner' from 'repo_name': ${repo_name}.`)
}
const repo_ = repo_name.substring(repo_name.indexOf('/') + 1)
if (!repo_) {
throw new Error(`Could not extract 'repo' from 'repo_name': ${repo_name}.`)
}
return {
owner,
repo: repo_
}
}
async function run(): Promise<void> {
try {
// Get the inputs from the workflow file: https://github.com/actions/toolkit/tree/master/packages/core#inputsoutputs
const token = core.getInput('repo_token', {required: true})
const file = core.getInput('file', {required: true})
const tag = core
.getInput('tag', {required: true})
.replace('refs/tags/', '')
.replace('refs/heads/', '')
const file_glob = core.getInput('file_glob') == 'true' ? true : false
const overwrite = core.getInput('overwrite') == 'true' ? true : false
const prerelease = core.getInput('prerelease') == 'true' ? true : false
const release_name = core.getInput('release_name')
const body = core
.getInput('body')
.replace(/%0A/gi, '\n')
.replace(/%0D/gi, '\r')
.replace(/%25/g, '%')
const octokit = github.getOctokit(token)
const release = await get_release_by_tag(
tag,
prerelease,
release_name,
body,
octokit
)
if (file_glob) {
const files = glob.sync(file)
if (files.length > 0) {
for (const file_ of files) {
const asset_name = path.basename(file_)
const asset_download_url = await upload_to_release(
release,
file_,
asset_name,
tag,
overwrite,
octokit
)
core.setOutput('browser_download_url', asset_download_url)
}
} else {
core.setFailed('No files matching the glob pattern found.')
}
} else {
const asset_name =
core.getInput('asset_name') !== ''
? core.getInput('asset_name').replace(/\$tag/g, tag)
: path.basename(file)
const asset_download_url = await upload_to_release(
release,
file,
asset_name,
tag,
overwrite,
octokit
)
core.setOutput('browser_download_url', asset_download_url)
}
} catch (error: any) {
core.setFailed(error.message)
}
}
run()

View File

@@ -1,63 +1,12 @@
{ {
"compilerOptions": { "compilerOptions": {
/* Basic Options */ "target": "es6",
// "incremental": true, /* Enable incremental compilation */ "module": "commonjs",
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "outDir": "./lib",
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "rootDir": "./src",
// "allowJs": true, /* Allow javascript files to be compiled. */ "strict": true,
// "checkJs": true, /* Report errors in .js files. */ "noImplicitAny": true,
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ "esModuleInterop": true
// "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"] "exclude": ["node_modules", "**/*.test.ts"]
} }