Compare commits
143 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdcc88a9ac | ||
|
|
033b82b409 | ||
|
|
e774b3eb81 | ||
|
|
80732ccbb8 | ||
|
|
8b72352976 | ||
|
|
e1e10133db | ||
|
|
7fdd38c8a8 | ||
|
|
fb175cca64 | ||
|
|
c4d491c3c9 | ||
|
|
aa3b2fa675 | ||
|
|
215ba89ed6 | ||
|
|
a8bcd956fb | ||
|
|
bb3709bff2 | ||
|
|
e9a92928b6 | ||
|
|
765cc979be | ||
|
|
00fc285722 | ||
|
|
1cbdc80532 | ||
|
|
4b91e3add1 | ||
|
|
b6d6ead779 | ||
|
|
1da2ee60a2 | ||
|
|
4f8867fa5e | ||
|
|
f4b7f82f58 | ||
|
|
4074199da7 | ||
|
|
578e4141d1 | ||
|
|
a36404d62c | ||
|
|
7588f628d1 | ||
|
|
1e3e9c6637 | ||
|
|
c03240caba | ||
|
|
66b1844f0b | ||
|
|
a8aa04e74a | ||
|
|
39c57feb7b | ||
|
|
02a91b5ddd | ||
|
|
0300282a53 | ||
|
|
c4a7702e18 | ||
|
|
4f53bc4bbe | ||
|
|
37813b746a | ||
|
|
b878ec7b82 | ||
|
|
3453d72d33 | ||
|
|
712dbe3d31 | ||
|
|
a454b0181b | ||
|
|
454de296e8 | ||
|
|
823125756f | ||
|
|
53f1c32531 | ||
|
|
7b2b452a12 | ||
|
|
a7c3669135 | ||
|
|
26cdd97dfd | ||
|
|
5a5f227332 | ||
|
|
9324133e56 | ||
|
|
25918b039f | ||
|
|
c18db47aba | ||
|
|
d968c2d7a7 | ||
|
|
e386e41d9f | ||
|
|
476ee61234 | ||
|
|
6db48ced34 | ||
|
|
7ce102b15b | ||
|
|
ddbfce0d45 | ||
|
|
b4b70f8196 | ||
|
|
2600a44651 | ||
|
|
eb7dfdf4be | ||
|
|
e2ce571994 | ||
|
|
69d25a3184 | ||
|
|
b36d9409a9 | ||
|
|
6c75be85e5 | ||
|
|
2d19fb459b | ||
|
|
9cfd0835c6 | ||
|
|
37c87f6b53 | ||
|
|
7288236d4e | ||
|
|
384ae1fad6 | ||
|
|
9347837845 | ||
|
|
893ce36b2e | ||
|
|
c07e9f4dff | ||
|
|
cb77c9ee9c | ||
|
|
8c78ca2662 | ||
|
|
2b385230bf | ||
|
|
3ff6c7eb03 | ||
|
|
3aa9307b7d | ||
|
|
c13ca79f19 | ||
|
|
e9a4ba6596 | ||
|
|
ef679c1c54 | ||
|
|
eb05307dce | ||
|
|
5a8bbe8ea7 | ||
|
|
a48ee3f85e | ||
|
|
bf3b51b3f3 | ||
|
|
67d60d576c | ||
|
|
0371ac0a22 | ||
|
|
231dd3fbcd | ||
|
|
d51f1872a4 | ||
|
|
324f6f4a19 | ||
|
|
ef3e5b02bd | ||
|
|
215101a6e6 | ||
|
|
a5996b3a73 | ||
|
|
8fd54fa522 | ||
|
|
c358143117 | ||
|
|
a2e71bdd4e | ||
|
|
78ea7b5528 | ||
|
|
3898f7abfd | ||
|
|
2afcaec515 | ||
|
|
2954d914c0 | ||
|
|
0bf6967166 | ||
|
|
3dd806f2bf | ||
|
|
443f2c0c79 | ||
|
|
94ba3874ff | ||
|
|
c30ce84c21 | ||
|
|
1830b037be | ||
|
|
3bacd9e49a | ||
|
|
3ac4132803 | ||
|
|
b072aaafe1 | ||
|
|
f3ea29dca7 | ||
|
|
889eb279f8 | ||
|
|
5b3ed26ce2 | ||
|
|
fc324198c9 | ||
|
|
7018cf7fe6 | ||
|
|
c0a948e0a1 | ||
|
|
64d30d31e9 | ||
|
|
0776e821ce | ||
|
|
21fb52b82e | ||
|
|
994ff9f3e4 | ||
|
|
ca859d0f82 | ||
|
|
5ffcfca321 | ||
|
|
3d2de22e3d | ||
|
|
353daac015 | ||
|
|
17085ec3c4 | ||
|
|
2d5b7ef7e5 | ||
|
|
a14d847ec5 | ||
|
|
f24914729f | ||
|
|
d7ebb9b36b | ||
|
|
8a61907f5d | ||
|
|
c9494285dc | ||
|
|
3a295d0589 | ||
|
|
c99c52b068 | ||
|
|
1298899b9a | ||
|
|
15c5838b25 | ||
|
|
eebdfaf405 | ||
|
|
1cbbf13906 | ||
|
|
421213779e | ||
|
|
7719db6a69 | ||
|
|
0e0b15bbc5 | ||
|
|
29a6629a49 | ||
|
|
18990f60e0 | ||
|
|
d37e2be74a | ||
|
|
eed740324c | ||
|
|
4f104f8afe | ||
|
|
700d6bf347 |
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -11,11 +11,15 @@ jobs:
|
||||
check_pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: "yarn install"
|
||||
run: yarn install
|
||||
|
||||
|
||||
- name: "yarn build"
|
||||
run: yarn build
|
||||
|
||||
|
||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@@ -5,7 +5,11 @@ jobs:
|
||||
check_pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: "yarn install"
|
||||
run: yarn install
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -95,4 +95,7 @@ fabric.properties
|
||||
# End of https://www.gitignore.io/api/webstorm
|
||||
|
||||
# Coverage
|
||||
coverage
|
||||
coverage
|
||||
|
||||
# Ignore lib, it contains intermediates
|
||||
/lib
|
||||
70
README.md
70
README.md
@@ -2,33 +2,46 @@
|
||||
|
||||
This action will create a GitHub release and optionally upload an artifact to it.
|
||||
|
||||
<div align="center">
|
||||
<strong>
|
||||
<samp>
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
## Action Inputs
|
||||
| Input name | Description | Required | Default Value |
|
||||
|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|----------------------|
|
||||
| allowUpdates | An optional flag which indicates if we should update a release if it already exists. Defaults to false. | false | "" |
|
||||
| artifactErrorsFailBuild | An optional flag which indicates if artifact read or upload errors should fail the build. | false | "" |
|
||||
| artifacts | An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs) | false | "" |
|
||||
| artifactContentType | The content type of the artifact. Defaults to raw | false | "" |
|
||||
| body | An optional body for the release. | false | "" |
|
||||
| bodyFile | An optional body file for the release. This should be the path to the file. | false | "" |
|
||||
| commit | An optional commit reference. This will be used to create the tag if it does not exist. | false | "" |
|
||||
| discussionCategory | When provided this will generate a discussion of the specified category. The category must exist otherwise this will cause the action to fail. This isn't used with draft releases | false | "" |
|
||||
| draft | Optionally marks this release as a draft release. Set to true to enable. | false | "" |
|
||||
| generateReleaseNotes | Indicates if release notes should be automatically generated. | false | false |
|
||||
| name | An optional name for the release. If this is omitted the tag will be used. | false | "" |
|
||||
| omitBody | Indicates if the release body should be omitted. | false | false |
|
||||
| omitBodyDuringUpdate | Indicates if the release body should be omitted during updates. The body will still be applied for newly created releases. This will preserve the existing body during updates. | false | false |
|
||||
| omitDraftDuringUpdate | Indicates if the draft flag should be omitted during updates. The draft flag will still be applied for newly created releases. This will preserve the existing draft state during updates. | false | false |
|
||||
| omitName | Indicates if the release name should be omitted. | false | false |
|
||||
| omitNameDuringUpdate | Indicates if the release name should be omitted during updates. The name will still be applied for newly created releases. This will preserve the existing name during updates. | false | false |
|
||||
| omitPrereleaseDuringUpdate | Indicates if the prerelease flag should be omitted during updates. The prerelease flag will still be applied for newly created releases. This will preserve the existing prerelease state during updates. | false | false |
|
||||
| owner | Optionally specify the owner of the repo where the release should be generated. Defaults to current repo'sowner. | false | "current repo owner" |
|
||||
| prerelease | Optionally marks this release as prerelease. Set to true to enable. | false | "" |
|
||||
| removeArtifacts | Indicates if existing release artifacts should be removed. | false | false |
|
||||
| replacesArtifacts | Indicates if existing release artifacts should be replaced. | false | true |
|
||||
| repo | Optionally specify the repo where the release should be generated. | false | current repo |
|
||||
| tag | An optional tag for the release. If this is omitted the git ref will be used (if it is a tag). | false | "" |
|
||||
| token | The GitHub token. This will default to the GitHub app token. This is primarily useful if you want to use your personal token (for targeting other repos, etc). If you are using a personal access token it should have access to the `repo` scope. | false | github.token |
|
||||
| Input name | Description | Required | Default Value |
|
||||
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|----------------------|
|
||||
| allowUpdates | An optional flag which indicates if we should update a release if it already exists. Defaults to false. | false | "" |
|
||||
| artifactErrorsFailBuild | An optional flag which indicates if artifact read or upload errors should fail the build. | false | "" |
|
||||
| artifacts | An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs) | false | "" |
|
||||
| artifactContentType | The content type of the artifact. Defaults to raw | false | "" |
|
||||
| body | An optional body for the release. Note: This input will have white space trimmed before and after it. Use `bodyFile` if you need a non-trivial markdown body. | false | "" |
|
||||
| bodyFile | An optional body file for the release. This should be the path to the file. | false | "" |
|
||||
| commit | An optional commit reference. This will be used to create the tag if it does not exist. | false | "" |
|
||||
| discussionCategory | When provided this will generate a discussion of the specified category. The category must exist otherwise this will cause the action to fail. This isn't used with draft releases. The default "Announcements" category is not supported via the API and will cause an error if used here. | false | "" |
|
||||
| draft | Optionally marks this release as a draft release. Set to true to enable. | false | "" |
|
||||
| generateReleaseNotes | Indicates if release notes should be automatically generated. | false | false |
|
||||
| makeLatest | Indicates if the release should be the "latest" release or not. legacy specifies that the latest release should be determined based on the release creation date and higher semantic version. | false | "legacy" |
|
||||
| name | An optional name for the release. If this is omitted the tag will be used. | false | "" |
|
||||
| omitBody | Indicates if the release body should be omitted. | false | false |
|
||||
| omitBodyDuringUpdate | Indicates if the release body should be omitted during updates. The body will still be applied for newly created releases. This will preserve the existing body during updates. | false | false |
|
||||
| omitDraftDuringUpdate | Indicates if the draft flag should be omitted during updates. The draft flag will still be applied for newly created releases. This will preserve the existing draft state during updates. | false | false |
|
||||
| omitName | Indicates if the release name should be omitted. | false | false |
|
||||
| omitNameDuringUpdate | Indicates if the release name should be omitted during updates. The name will still be applied for newly created releases. This will preserve the existing name during updates. | false | false |
|
||||
| omitPrereleaseDuringUpdate | Indicates if the prerelease flag should be omitted during updates. The prerelease flag will still be applied for newly created releases. This will preserve the existing prerelease state during updates. | false | false |
|
||||
| owner | Optionally specify the owner of the repo where the release should be generated. Defaults to current repo's owner. | false | "current repo owner" |
|
||||
| prerelease | Optionally marks this release as prerelease. Set to true to enable. | false | "" |
|
||||
| removeArtifacts | Indicates if existing release artifacts should be removed. | false | false |
|
||||
| replacesArtifacts | Indicates if existing release artifacts should be replaced. | false | true |
|
||||
| repo | Optionally specify the repo where the release should be generated. | false | current repo |
|
||||
| skipIfReleaseExists | When skipIfReleaseExists is enabled the action will be skipped if a non-draft release already exists for the provided tag. | false | false |
|
||||
| tag | An optional tag for the release. If this is omitted the git ref will be used (if it is a tag). | false | "" |
|
||||
| token | The GitHub token. This will default to the GitHub app token. This is primarily useful if you want to use your personal token (for targeting other repos, etc). If you are using a personal access token it should have access to the `repo` scope. | false | github.token |
|
||||
| updateOnlyUnreleased | When allowUpdates is enabled, this will fail the action if the release it is updating is not a draft or a prerelease. | false | false |
|
||||
|
||||
## Action Outputs
|
||||
| Output name | Description |
|
||||
@@ -55,16 +68,15 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "release.tar.gz,foo/*.txt"
|
||||
bodyFile: "body.md"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
```
|
||||
|
||||
## Notes
|
||||
- You must provide a tag either via the action input or the git ref (i.e push / create a tag). If you do not provide a tag the action will fail.
|
||||
- If the tag of the release you are creating does not yet exist, you should set both the `tag` and `commit` action inputs. `commit` can point to a commit hash or a branch name (ex - `main`).
|
||||
- In the example above only required permissions for the action specified (which is `contents: write`). If you add other actions to the same workflow you should expand `permissions` block accordingly.
|
||||
- More info about why the default discussion category "Announcements" does not work with this action may be found here: https://github.com/goreleaser/goreleaser/issues/2304.
|
||||
86
README.zh-Hans.md
Normal file
86
README.zh-Hans.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# Release Action
|
||||
|
||||
此操作将创建一个 GitHub Release,并可选择将产出文件上传到其中。
|
||||
|
||||
<div align="center">
|
||||
<strong>
|
||||
<samp>
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
## Action 输入
|
||||
|
||||
| 输入名称 | 描述 | 必选 | 默认值 |
|
||||
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | -------------------- |
|
||||
| allowUpdates | 一个可选标志,表示如果版本已经存在,我们是否应该更新它。默认值为 false。 | false | "" |
|
||||
| artifactErrorsFailBuild | 一个可选标志,表示读取或上传产出文件错误时是否应该使构建失败。 | false | "" |
|
||||
| artifacts | 一组可选的路径,表示要上传到版本的产出文件。 这可能是单个路径或以逗号分隔的路径列表(或 globs) | false | "" |
|
||||
| artifactContentType | 产出文件的内容类型。 默认为 raw | false | "" |
|
||||
| body | 发布的可选主体。注意:此处输入的首尾空格会被去除。如果您需要特殊的 markdown 内容,请使用 `bodyFile`。 | false | "" |
|
||||
| bodyFile | 发布的可选正文文件。 这应该是文件的路径。 | false | "" |
|
||||
| commit | 一个可选的提交 ref。 如果标签不存在,将用于创建标签。 | false | "" |
|
||||
| discussionCategory | 当提供该选项时,将生成指定类别的 discussion。指定的类别必须存在,否则将导致 Action 失败。这对草案状态的发布不生效。API 不支持默认的 Announcement 分类,使用这个分类会引发错误。 | false | "" |
|
||||
| draft | 可选择将此版本标记为草稿版本。 设置为 true 以启用。 | false | "" |
|
||||
| generateReleaseNotes | 指示是否应自动生成发行说明。 | false | false |
|
||||
| makeLatest | 指示是否将这个发布设置为 latest。使用"lagecy"值则会根据发布时间和语义化版本号自动决定。 | false | "legacy" |
|
||||
| name | 版本的可选名称。 如果省略,将使用标签。 | false | "" |
|
||||
| omitBody | 指示是否应省略发布主体。 | false | false |
|
||||
| omitBodyDuringUpdate | 指示在更新期间是否应省略发布主体。 正文仍将应用于新创建的版本。 这将在更新期间保留现有正文。 | false | false |
|
||||
| omitDraftDuringUpdate | 指示是否应在更新期间省略草稿标志。 草稿标志仍将应用于新创建的版本。 这将在更新期间保留现有的草稿状态。 | false | false |
|
||||
| omitName | 指示是否应省略版本名称。 | false | false |
|
||||
| omitNameDuringUpdate | 指示在更新期间是否应省略版本名称。 该名称仍将应用于新创建的版本。 这将在更新期间保留现有名称。 | false | false |
|
||||
| omitPrereleaseDuringUpdate | 指示在更新期间是否应省略预发布标志。 预发布标志仍将应用于新创建的版本。 这将在更新期间保留现有的预发布状态。 | false | false |
|
||||
| owner | (可选)指定应在其中生成版本的存储库的所有者。 默认为当前存储库的所有者。 | false | "current repo owner" |
|
||||
| prerelease | 可选择将此版本标记为预发布。 设置为 true 以启用。 | false | "" |
|
||||
| removeArtifacts | 指示是否应删除现有的发布产出文件。 | false | false |
|
||||
| replacesArtifacts | 指示是否应替换现有的发布产出文件。 | false | true |
|
||||
| repo | (可选)指定应在其中生成版本的存储库。 | false | current repo |
|
||||
| skipIfReleaseExists | 当该选项启用时,如果提供的标签已存在一个对应的非草案状态的发布,则 action 将会被跳过。 | false | false |
|
||||
| tag | 发布的可选标签。 如果省略,将使用 git ref (如果它是标签)。 | false | "" |
|
||||
| token | GitHub 令牌。 这将默认为 GitHub 应用程序令牌。 如果您想使用您的个人令牌(用于定位其他存储库等),这主要是有用的。 如果您使用的是个人访问令牌,它应该可以访问 `repo` 范围。 | false | github.token |
|
||||
| updateOnlyUnreleased | 启用 allowUpdates 后,如果它正在更新的版本不是草稿或预发布,则该操作将失败。 | false | false |
|
||||
|
||||
## Action 输出
|
||||
|
||||
| 输出名称 | 描述 |
|
||||
| ---------- | ------------------------ |
|
||||
| id | 创建的版本的标识符。 |
|
||||
| html_url | 版本的 HTML URL。 |
|
||||
| upload_url | 将资产上传到版本的 URL。 |
|
||||
|
||||
## 示例
|
||||
|
||||
此示例将在推送一个标签时创建一个 Release:
|
||||
|
||||
```yml
|
||||
name: Releases
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "release.tar.gz,foo/*.txt"
|
||||
bodyFile: "body.md"
|
||||
```
|
||||
|
||||
## 注意
|
||||
|
||||
- 您必须通过 Action 输入或 git ref 提供一个标签(即推送/创建标签)。如果不提供标签,Action 将会失败。
|
||||
- 如果您正在创建的版本的标签不存在,您应该同时设置标签和提交 Action 输入。 commit 可以指向提交 Hash 或分支名称(例如 - main)。
|
||||
- 在上面的示例中,只需要指定操作的权限(即 contents: write)。 如果您将其他操作添加到同一工作流程,则应相应地扩展权限。
|
||||
- 有关于此 action 无法支持 discussion 的 Announcement 分类的原因的更多信息,请参见此处:https://github.com/goreleaser/goreleaser/issues/2304
|
||||
@@ -5,16 +5,18 @@ import {Releases} from "../src/Releases";
|
||||
import {ArtifactUploader} from "../src/ArtifactUploader";
|
||||
import {Outputs} from "../src/Outputs";
|
||||
import {ArtifactDestroyer} from "../src/ArtifactDestroyer";
|
||||
import {ActionSkipper} from "../src/ActionSkipper";
|
||||
|
||||
const applyReleaseDataMock = jest.fn()
|
||||
const artifactDestroyMock = jest.fn()
|
||||
const createMock = jest.fn()
|
||||
const deleteMock = jest.fn()
|
||||
const getMock = jest.fn()
|
||||
const listArtifactsMock = jest.fn()
|
||||
const listMock = jest.fn()
|
||||
const shouldSkipMock = jest.fn()
|
||||
const updateMock = jest.fn()
|
||||
const uploadMock = jest.fn()
|
||||
const artifactDestroyMock = jest.fn()
|
||||
|
||||
const artifacts = [
|
||||
new Artifact('a/art1'),
|
||||
@@ -37,13 +39,16 @@ const updateBody = 'updateBody'
|
||||
const updateDraft = false
|
||||
const updateName = 'updateName'
|
||||
const updatePrerelease = false
|
||||
const updateOnlyUnreleased = false
|
||||
const url = 'http://api.example.com'
|
||||
const makeLatest = 'legacy'
|
||||
|
||||
describe("Action", () => {
|
||||
beforeEach(() => {
|
||||
createMock.mockClear()
|
||||
getMock.mockClear()
|
||||
listMock.mockClear()
|
||||
shouldSkipMock.mockClear()
|
||||
updateMock.mockClear()
|
||||
uploadMock.mockClear()
|
||||
})
|
||||
@@ -59,6 +64,7 @@ describe("Action", () => {
|
||||
discussionCategory,
|
||||
createDraft,
|
||||
generateReleaseNotes,
|
||||
makeLatest,
|
||||
createName,
|
||||
createPrerelease)
|
||||
expect(uploadMock).not.toBeCalled()
|
||||
@@ -79,6 +85,7 @@ describe("Action", () => {
|
||||
discussionCategory,
|
||||
createDraft,
|
||||
generateReleaseNotes,
|
||||
makeLatest,
|
||||
createName,
|
||||
createPrerelease)
|
||||
expect(uploadMock).toBeCalledWith(artifacts, releaseId, url)
|
||||
@@ -104,6 +111,7 @@ describe("Action", () => {
|
||||
discussionCategory,
|
||||
createDraft,
|
||||
generateReleaseNotes,
|
||||
makeLatest,
|
||||
createName,
|
||||
createPrerelease
|
||||
)
|
||||
@@ -124,6 +132,7 @@ describe("Action", () => {
|
||||
discussionCategory,
|
||||
createDraft,
|
||||
generateReleaseNotes,
|
||||
makeLatest,
|
||||
createName,
|
||||
createPrerelease
|
||||
)
|
||||
@@ -149,6 +158,16 @@ describe("Action", () => {
|
||||
assertOutputApplied()
|
||||
})
|
||||
|
||||
it('skips action', async () => {
|
||||
const action = createAction(false, false, false)
|
||||
shouldSkipMock.mockResolvedValue(true)
|
||||
|
||||
await action.perform()
|
||||
|
||||
expect(createMock).not.toBeCalled()
|
||||
expect(updateMock).not.toBeCalled()
|
||||
})
|
||||
|
||||
it('throws error when create fails', async () => {
|
||||
const action = createAction(false, true)
|
||||
createMock.mockRejectedValue("error")
|
||||
@@ -167,6 +186,7 @@ describe("Action", () => {
|
||||
discussionCategory,
|
||||
createDraft,
|
||||
generateReleaseNotes,
|
||||
makeLatest,
|
||||
createName,
|
||||
createPrerelease
|
||||
)
|
||||
@@ -198,6 +218,32 @@ describe("Action", () => {
|
||||
|
||||
})
|
||||
|
||||
it('throws error when list has no data', async () => {
|
||||
|
||||
const action = createAction(true, true)
|
||||
getMock.mockRejectedValue({status: 404})
|
||||
const error = {
|
||||
errors: [
|
||||
{
|
||||
code: 'already_exists'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
createMock.mockRejectedValue(error)
|
||||
listMock.mockResolvedValue({})
|
||||
expect.hasAssertions()
|
||||
try {
|
||||
await action.perform()
|
||||
} catch (error) {
|
||||
expect(error).toEqual(Error("No releases found. Response: {}"))
|
||||
}
|
||||
|
||||
expect(listMock).toBeCalled()
|
||||
expect(createMock).not.toBeCalled()
|
||||
expect(updateMock).not.toBeCalled()
|
||||
})
|
||||
|
||||
it('throws error when update fails', async () => {
|
||||
const action = createAction(true, true)
|
||||
|
||||
@@ -217,6 +263,7 @@ describe("Action", () => {
|
||||
commit,
|
||||
discussionCategory,
|
||||
updateDraft,
|
||||
makeLatest,
|
||||
updateName,
|
||||
updatePrerelease
|
||||
)
|
||||
@@ -242,6 +289,7 @@ describe("Action", () => {
|
||||
discussionCategory,
|
||||
createDraft,
|
||||
generateReleaseNotes,
|
||||
makeLatest,
|
||||
createName,
|
||||
createPrerelease
|
||||
)
|
||||
@@ -268,6 +316,7 @@ describe("Action", () => {
|
||||
commit,
|
||||
discussionCategory,
|
||||
updateDraft,
|
||||
makeLatest,
|
||||
updateName,
|
||||
updatePrerelease
|
||||
)
|
||||
@@ -287,6 +336,7 @@ describe("Action", () => {
|
||||
commit,
|
||||
discussionCategory,
|
||||
updateDraft,
|
||||
makeLatest,
|
||||
updateName,
|
||||
updatePrerelease
|
||||
)
|
||||
@@ -306,6 +356,7 @@ describe("Action", () => {
|
||||
commit,
|
||||
discussionCategory,
|
||||
updateDraft,
|
||||
makeLatest,
|
||||
updateName,
|
||||
updatePrerelease
|
||||
)
|
||||
@@ -317,7 +368,9 @@ describe("Action", () => {
|
||||
expect(applyReleaseDataMock).toBeCalledWith({id: releaseId, upload_url: url})
|
||||
}
|
||||
|
||||
function createAction(allowUpdates: boolean, hasArtifact: boolean, removeArtifacts: boolean = false): Action {
|
||||
function createAction(allowUpdates: boolean,
|
||||
hasArtifact: boolean,
|
||||
removeArtifacts: boolean = false): Action {
|
||||
let inputArtifact: Artifact[]
|
||||
if (hasArtifact) {
|
||||
inputArtifact = artifacts
|
||||
@@ -350,6 +403,7 @@ describe("Action", () => {
|
||||
listMock.mockResolvedValue({
|
||||
data: []
|
||||
})
|
||||
shouldSkipMock.mockResolvedValue(false)
|
||||
updateMock.mockResolvedValue({
|
||||
data: {
|
||||
id: releaseId,
|
||||
@@ -369,17 +423,20 @@ describe("Action", () => {
|
||||
commit: commit,
|
||||
discussionCategory: discussionCategory,
|
||||
generateReleaseNotes: true,
|
||||
makeLatest: makeLatest,
|
||||
owner: "owner",
|
||||
createdPrerelease: createPrerelease,
|
||||
replacesArtifacts: replacesArtifacts,
|
||||
removeArtifacts: removeArtifacts,
|
||||
repo: "repo",
|
||||
skipIfReleaseExists: false,
|
||||
tag: tag,
|
||||
token: token,
|
||||
updatedDraft: updateDraft,
|
||||
updatedReleaseBody: updateBody,
|
||||
updatedReleaseName: updateName,
|
||||
updatedPrerelease: updatePrerelease
|
||||
updatedPrerelease: updatePrerelease,
|
||||
updateOnlyUnreleased: updateOnlyUnreleased
|
||||
}
|
||||
})
|
||||
const MockOutputs = jest.fn<Outputs, any>(() => {
|
||||
@@ -398,12 +455,19 @@ describe("Action", () => {
|
||||
}
|
||||
})
|
||||
|
||||
const MockActionSkipper = jest.fn<ActionSkipper, any>(() => {
|
||||
return {
|
||||
shouldSkip: shouldSkipMock
|
||||
}
|
||||
})
|
||||
|
||||
const inputs = new MockInputs()
|
||||
const outputs = new MockOutputs()
|
||||
const releases = new MockReleases()
|
||||
const uploader = new MockUploader()
|
||||
const artifactDestroyer = new MockArtifactDestroyer()
|
||||
const actionSkipper = new MockActionSkipper()
|
||||
|
||||
return new Action(inputs, outputs, releases, uploader, artifactDestroyer)
|
||||
return new Action(inputs, outputs, releases, uploader, artifactDestroyer, actionSkipper)
|
||||
}
|
||||
})
|
||||
|
||||
44
__tests__/ActionSkipper.test.ts
Normal file
44
__tests__/ActionSkipper.test.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import {ActionSkipper, ReleaseActionSkipper} from "../src/ActionSkipper";
|
||||
import {Releases} from "../src/Releases";
|
||||
|
||||
describe("shouldSkip", () => {
|
||||
const getMock = jest.fn()
|
||||
const tag = "tag"
|
||||
const MockReleases = jest.fn<Releases, any>(() => {
|
||||
return {
|
||||
create: jest.fn(),
|
||||
deleteArtifact: jest.fn(),
|
||||
getByTag: getMock,
|
||||
listArtifactsForRelease: jest.fn(),
|
||||
listReleases: jest.fn(),
|
||||
update: jest.fn(),
|
||||
uploadArtifact: jest.fn()
|
||||
}
|
||||
})
|
||||
|
||||
it('should return false when skipIfReleaseExists is false', async () => {
|
||||
const actionSkipper = new ReleaseActionSkipper(false, MockReleases(), tag)
|
||||
expect(await actionSkipper.shouldSkip()).toBe(false)
|
||||
})
|
||||
|
||||
it('should return false when error occurs', async () => {
|
||||
getMock.mockRejectedValue(new Error())
|
||||
|
||||
const actionSkipper = new ReleaseActionSkipper(true, MockReleases(), tag)
|
||||
expect(await actionSkipper.shouldSkip()).toBe(false)
|
||||
})
|
||||
|
||||
it('should return false when release does not exist', async () => {
|
||||
getMock.mockResolvedValue({})
|
||||
|
||||
const actionSkipper = new ReleaseActionSkipper(true, MockReleases(), tag)
|
||||
expect(await actionSkipper.shouldSkip()).toBe(false)
|
||||
})
|
||||
|
||||
it('should return true when release does exist', async () => {
|
||||
getMock.mockResolvedValue({data: {}})
|
||||
|
||||
const actionSkipper = new ReleaseActionSkipper(true, MockReleases(), tag)
|
||||
expect(await actionSkipper.shouldSkip()).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -1,12 +1,14 @@
|
||||
import { Artifact } from "../src/Artifact";
|
||||
import {Artifact} from "../src/Artifact";
|
||||
|
||||
const fileContents = Buffer.from('artful facts', 'utf-8')
|
||||
const contentLength = 42
|
||||
const fakeReadStream = {}
|
||||
|
||||
jest.mock('fs', () => {
|
||||
return {
|
||||
readFileSync: () => fileContents,
|
||||
statSync: () => { return { size: contentLength } }
|
||||
createReadStream: () => fakeReadStream,
|
||||
statSync: () => {
|
||||
return {size: contentLength}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
@@ -33,6 +35,6 @@ describe("Artifact", () => {
|
||||
|
||||
it('reads artifact', () => {
|
||||
const artifact = new Artifact('some/artifact')
|
||||
expect(artifact.readFile()).toBe(fileContents)
|
||||
expect(artifact.readFile()).toBe(fakeReadStream)
|
||||
})
|
||||
})
|
||||
@@ -21,6 +21,9 @@ jest.mock('fs', () => {
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
realpathSync: () => {
|
||||
return false
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
@@ -7,7 +7,7 @@ const artifacts = [
|
||||
new Artifact('a/art1'),
|
||||
new Artifact('b/art2')
|
||||
]
|
||||
const fileContents = Buffer.from('artful facts', 'utf-8')
|
||||
const fakeReadStream = {}
|
||||
const contentLength = 42
|
||||
const releaseId = 100
|
||||
const url = 'http://api.example.com'
|
||||
@@ -17,13 +17,16 @@ const listArtifactsMock = jest.fn()
|
||||
const uploadMock = jest.fn()
|
||||
|
||||
jest.mock('fs', () => {
|
||||
const originalFs = jest.requireActual('fs');
|
||||
return {
|
||||
readFileSync: () => fileContents,
|
||||
...originalFs,
|
||||
promises: {},
|
||||
createReadStream: () => fakeReadStream,
|
||||
statSync: () => {
|
||||
return {size: contentLength}
|
||||
return {size: contentLength};
|
||||
}
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
describe('ArtifactUploader', () => {
|
||||
beforeEach(() => {
|
||||
@@ -41,9 +44,9 @@ describe('ArtifactUploader', () => {
|
||||
|
||||
expect(uploadMock).toBeCalledTimes(2)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art2', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art2', releaseId)
|
||||
|
||||
expect(deleteMock).toBeCalledTimes(0)
|
||||
})
|
||||
@@ -57,15 +60,15 @@ describe('ArtifactUploader', () => {
|
||||
|
||||
expect(uploadMock).toBeCalledTimes(5)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art2', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art2', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art2', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art2', releaseId)
|
||||
|
||||
expect(deleteMock).toBeCalledTimes(0)
|
||||
})
|
||||
@@ -80,9 +83,9 @@ describe('ArtifactUploader', () => {
|
||||
|
||||
expect(uploadMock).toBeCalledTimes(2)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art2', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art2', releaseId)
|
||||
|
||||
expect(deleteMock).toBeCalledTimes(2)
|
||||
expect(deleteMock).toBeCalledWith(1)
|
||||
@@ -99,9 +102,9 @@ describe('ArtifactUploader', () => {
|
||||
|
||||
expect(uploadMock).toBeCalledTimes(2)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art2', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art2', releaseId)
|
||||
|
||||
expect(deleteMock).toBeCalledTimes(0)
|
||||
})
|
||||
@@ -115,13 +118,13 @@ describe('ArtifactUploader', () => {
|
||||
|
||||
expect(uploadMock).toBeCalledTimes(4)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art2', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art2', releaseId)
|
||||
|
||||
expect(deleteMock).toBeCalledTimes(0)
|
||||
})
|
||||
@@ -163,9 +166,9 @@ describe('ArtifactUploader', () => {
|
||||
|
||||
expect(uploadMock).toBeCalledTimes(2)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art1', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art1', releaseId)
|
||||
expect(uploadMock)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fileContents, 'art2', releaseId)
|
||||
.toBeCalledWith(url, contentLength, 'raw', fakeReadStream, 'art2', releaseId)
|
||||
|
||||
expect(deleteMock).toBeCalledTimes(0)
|
||||
})
|
||||
|
||||
@@ -29,6 +29,31 @@ describe('ErrorMessage', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('has error with remediation', () => {
|
||||
it('provides remediation with 404 without errors', () => {
|
||||
const error = { status: 404, message: "message" }
|
||||
const githubError = new GithubError(error)
|
||||
expect(githubError.toString())
|
||||
.toBe('Error 404: message\nMake sure your github token has access to the repo and has permission to author releases')
|
||||
})
|
||||
|
||||
it('provides remediation with 404 with errors', () => {
|
||||
const error = {
|
||||
message: 'message',
|
||||
errors: [
|
||||
{
|
||||
code: 'missing',
|
||||
resource: 'release'
|
||||
}
|
||||
],
|
||||
status: 404
|
||||
}
|
||||
const githubError = new GithubError(error)
|
||||
expect(githubError.toString())
|
||||
.toBe('Error 404: message\nErrors:\n- release does not exist.\nMake sure your github token has access to the repo and has permission to author releases')
|
||||
})
|
||||
})
|
||||
|
||||
it('generates message with errors', () => {
|
||||
const error = {
|
||||
message: 'something bad happened',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const mockGetInput = jest.fn();
|
||||
const mockGetBooleanInput = jest.fn();
|
||||
const mockGlob = jest.fn()
|
||||
const mockReadFileSync = jest.fn();
|
||||
const mockStatSync = jest.fn();
|
||||
@@ -14,7 +15,10 @@ const artifacts = [
|
||||
]
|
||||
|
||||
jest.mock('@actions/core', () => {
|
||||
return {getInput: mockGetInput};
|
||||
return {
|
||||
getInput: mockGetInput,
|
||||
getBooleanInput: mockGetBooleanInput
|
||||
};
|
||||
})
|
||||
|
||||
jest.mock('fs', () => {
|
||||
@@ -87,7 +91,7 @@ describe('Inputs', () => {
|
||||
expect(mockGlob).toBeCalledTimes(1)
|
||||
expect(mockGlob).toBeCalledWith('art1', 'contentType', true)
|
||||
})
|
||||
|
||||
|
||||
it('returns empty artifacts', () => {
|
||||
mockGetInput.mockReturnValueOnce('')
|
||||
.mockReturnValueOnce('')
|
||||
@@ -202,7 +206,7 @@ describe('Inputs', () => {
|
||||
mockGetInput.mockReturnValue('Release')
|
||||
expect(inputs.discussionCategory).toBe('Release')
|
||||
})
|
||||
|
||||
|
||||
it('returns undefined', () => {
|
||||
mockGetInput.mockReturnValue('')
|
||||
expect(inputs.discussionCategory).toBe(undefined)
|
||||
@@ -220,7 +224,29 @@ describe('Inputs', () => {
|
||||
expect(inputs.generateReleaseNotes).toBe(false)
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
describe('makeLatest', () => {
|
||||
it('returns legacy', () => {
|
||||
mockGetInput.mockReturnValueOnce('legacy')
|
||||
expect(inputs.makeLatest).toBe('legacy')
|
||||
})
|
||||
|
||||
it('returns false', () => {
|
||||
mockGetInput.mockReturnValueOnce('false')
|
||||
expect(inputs.makeLatest).toBe('false')
|
||||
})
|
||||
|
||||
it('returns true', () => {
|
||||
mockGetInput.mockReturnValueOnce('true')
|
||||
expect(inputs.makeLatest).toBe('true')
|
||||
})
|
||||
|
||||
it('returns undefined', () => {
|
||||
mockGetInput.mockReturnValueOnce('something_else')
|
||||
expect(inputs.makeLatest).toBe(undefined)
|
||||
})
|
||||
})
|
||||
|
||||
describe('owner', () => {
|
||||
it('returns owner from context', function () {
|
||||
process.env.GITHUB_REPOSITORY = "owner/repo"
|
||||
@@ -278,6 +304,18 @@ describe('Inputs', () => {
|
||||
});
|
||||
})
|
||||
|
||||
describe('skipIfReleaseExists', () => {
|
||||
it('returns false', () => {
|
||||
mockGetBooleanInput.mockReturnValue(false)
|
||||
expect(inputs.skipIfReleaseExists).toBe(false)
|
||||
})
|
||||
|
||||
it('returns true', () => {
|
||||
mockGetBooleanInput.mockReturnValue(true)
|
||||
expect(inputs.skipIfReleaseExists).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('tag', () => {
|
||||
it('returns input tag', () => {
|
||||
mockGetInput.mockReturnValue('tag')
|
||||
@@ -430,6 +468,17 @@ describe('Inputs', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('updateOnlyUnreleased', () => {
|
||||
it('returns false', () => {
|
||||
expect(inputs.updateOnlyUnreleased).toBe(false)
|
||||
})
|
||||
|
||||
it('returns true', () => {
|
||||
mockGetInput.mockReturnValueOnce('true')
|
||||
expect(inputs.updateOnlyUnreleased).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
function createGlobber(): ArtifactGlobber {
|
||||
const MockGlobber = jest.fn<ArtifactGlobber, any>(() => {
|
||||
return {
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as path from "path";
|
||||
import {FileArtifactGlobber} from "../src/ArtifactGlobber";
|
||||
import {Outputs} from "../src/Outputs";
|
||||
import {GithubArtifactDestroyer} from "../src/ArtifactDestroyer";
|
||||
import {ReleaseActionSkipper} from "../src/ActionSkipper";
|
||||
|
||||
// This test is currently intended to be manually run during development. To run:
|
||||
// - Make sure you have an environment variable named GITHUB_TOKEN assigned to your token
|
||||
@@ -27,8 +28,9 @@ describe.skip('Integration Test', () => {
|
||||
inputs.artifactErrorsFailBuild,
|
||||
)
|
||||
const artifactDestroyer = new GithubArtifactDestroyer(releases)
|
||||
const actionSkipper = new ReleaseActionSkipper(inputs.skipIfReleaseExists, releases, inputs.tag)
|
||||
|
||||
action = new Action(inputs, outputs, releases, uploader, artifactDestroyer)
|
||||
action = new Action(inputs, outputs, releases, uploader, artifactDestroyer, actionSkipper)
|
||||
})
|
||||
|
||||
it('Performs action', async () => {
|
||||
@@ -52,12 +54,14 @@ describe.skip('Integration Test', () => {
|
||||
replacesArtifacts: true,
|
||||
removeArtifacts: false,
|
||||
repo: "actions-playground",
|
||||
skipIfReleaseExists: false,
|
||||
tag: "release-action-test",
|
||||
token: getToken(),
|
||||
updatedDraft: false,
|
||||
updatedReleaseBody: "This release was generated by release-action's integration test",
|
||||
updatedReleaseBody: "This release was updated by release-action's integration test",
|
||||
updatedReleaseName: "Releases Action Integration Test",
|
||||
updatedPrerelease: false
|
||||
updatedPrerelease: false,
|
||||
updateOnlyUnreleased: false
|
||||
}
|
||||
})
|
||||
return new MockInputs();
|
||||
|
||||
74
__tests__/ReleaseValidator.test.ts
Normal file
74
__tests__/ReleaseValidator.test.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import {ReleaseValidator} from "../src/ReleaseValidator";
|
||||
|
||||
describe("validateReleaseUpdate", () => {
|
||||
describe("updateOnlyUnreleased is disabled", () => {
|
||||
const validator = new ReleaseValidator(false)
|
||||
it('should not throw', () => {
|
||||
const releaseResponse = {
|
||||
draft: false,
|
||||
prerelease: false,
|
||||
name: "Name"
|
||||
}
|
||||
expect(() => {
|
||||
validator.validateReleaseUpdate(releaseResponse)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
describe("updateOnlyUnreleased is enabled", () => {
|
||||
const validator = new ReleaseValidator(true)
|
||||
it('should throw if neither draft or prerelease are enabled', () => {
|
||||
const releaseResponse = {
|
||||
draft: false,
|
||||
prerelease: false,
|
||||
name: "Name"
|
||||
}
|
||||
expect(() => {
|
||||
validator.validateReleaseUpdate(releaseResponse)
|
||||
}).toThrow()
|
||||
})
|
||||
|
||||
it('should not throw if draft is enabled', () => {
|
||||
const releaseResponse = {
|
||||
draft: true,
|
||||
prerelease: false,
|
||||
name: "Name"
|
||||
}
|
||||
expect(() => {
|
||||
validator.validateReleaseUpdate(releaseResponse)
|
||||
}).not.toThrow()
|
||||
})
|
||||
|
||||
it('should not throw if prerelease is enabled', () => {
|
||||
const releaseResponse = {
|
||||
draft: false,
|
||||
prerelease: true,
|
||||
name: "Name"
|
||||
}
|
||||
expect(() => {
|
||||
validator.validateReleaseUpdate(releaseResponse)
|
||||
}).not.toThrow()
|
||||
})
|
||||
|
||||
it('should not throw if draft & prerelease is enabled', () => {
|
||||
const releaseResponse = {
|
||||
draft: true,
|
||||
prerelease: true,
|
||||
name: "Name"
|
||||
}
|
||||
expect(() => {
|
||||
validator.validateReleaseUpdate(releaseResponse)
|
||||
}).not.toThrow()
|
||||
})
|
||||
|
||||
it('should default error message release name to release', () => {
|
||||
const releaseResponse = {
|
||||
draft: false,
|
||||
prerelease: false,
|
||||
name: null
|
||||
}
|
||||
expect(() => {
|
||||
validator.validateReleaseUpdate(releaseResponse)
|
||||
}).toThrow(`Tried to update "release" which is neither a draft or prerelease. (updateOnlyUnreleased is on)`)
|
||||
})
|
||||
})
|
||||
})
|
||||
16
action.yml
16
action.yml
@@ -47,6 +47,10 @@ inputs:
|
||||
description: 'Indicates if release notes should be automatically generated.'
|
||||
required: false
|
||||
default: 'false'
|
||||
makeLatest:
|
||||
description: 'Indicates if the release should be the "latest" release or not.'
|
||||
required: false
|
||||
default: 'legacy'
|
||||
name:
|
||||
description: 'An optional name for the release. If this is omitted the tag will be used.'
|
||||
required: false
|
||||
@@ -94,7 +98,11 @@ inputs:
|
||||
repo:
|
||||
description: "Optionally specify the repo where the release should be generated. Defaults to current repo"
|
||||
required: false
|
||||
default: ''
|
||||
default: ''
|
||||
skipIfReleaseExists:
|
||||
description: "When skipIfReleaseExists is enabled the action will be skipped if a non-draft release already exists for the provided tag."
|
||||
required: false
|
||||
default: 'false'
|
||||
tag:
|
||||
description: 'An optional tag for the release. If this is omitted the git ref will be used (if it is a tag).'
|
||||
required: false
|
||||
@@ -103,6 +111,10 @@ inputs:
|
||||
description: 'The Github token.'
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
updateOnlyUnreleased:
|
||||
description: "When allowUpdates is enabled, this will fail the action if the release it is updating is not a draft or a prerelease."
|
||||
required: false
|
||||
default: 'false'
|
||||
outputs:
|
||||
id:
|
||||
description: 'The identifier of the created release.'
|
||||
@@ -111,7 +123,7 @@ outputs:
|
||||
upload_url:
|
||||
description: 'The URL for uploading assets to the release.'
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
branding:
|
||||
icon: 'tag'
|
||||
|
||||
46776
dist/index.js
vendored
46776
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
372
dist/licenses.txt
vendored
372
dist/licenses.txt
vendored
@@ -10,6 +10,18 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/exec
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/github
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
@@ -47,6 +59,40 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@actions/io
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@fastify/busboy
|
||||
MIT
|
||||
Copyright Brian White. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
@octokit/auth-token
|
||||
MIT
|
||||
The MIT License
|
||||
@@ -219,16 +265,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@vercel/ncc
|
||||
MIT
|
||||
Copyright 2018 ZEIT, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
balanced-match
|
||||
MIT
|
||||
(MIT)
|
||||
@@ -484,28 +520,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
concat-map
|
||||
MIT
|
||||
This software is released under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
deprecation
|
||||
ISC
|
||||
The ISC License
|
||||
@@ -525,83 +539,11 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
fs.realpath
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
----
|
||||
|
||||
This library bundles a version of the `fs.realpath` and `fs.realpathSync`
|
||||
methods from Node.js v0.10 under the terms of the Node.js MIT license.
|
||||
|
||||
Node's license follows, also included at the header of `old.js` which contains
|
||||
the licensed code:
|
||||
|
||||
Copyright Joyent, Inc. and other Node contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
glob
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
## Glob Logo
|
||||
|
||||
Glob's logo created by Tanya Brassie <http://tanyabrassie.com/>, licensed
|
||||
under a Creative Commons Attribution-ShareAlike 4.0 International License
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
|
||||
inflight
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter
|
||||
Copyright (c) 2009-2023 Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -616,56 +558,30 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
inherits
|
||||
lru-cache
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter
|
||||
Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
|
||||
is-plain-object
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
minimatch
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -680,30 +596,23 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
node-fetch
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
minipass
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2016 David Frank
|
||||
Copyright (c) 2017-2023 npm, Inc., Isaac Z. Schlueter, and Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
once
|
||||
@@ -725,33 +634,64 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
path-is-absolute
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
path-scurry
|
||||
BlueOak-1.0.0
|
||||
# Blue Oak Model License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
Version 1.0.0
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
## Purpose
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
This license gives everyone as much permission to work with
|
||||
this software as possible, while protecting contributors
|
||||
from liability.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
## Acceptance
|
||||
|
||||
In order to receive this license, you must agree to its
|
||||
rules. The rules of this license are both obligations
|
||||
under that agreement and conditions to your license.
|
||||
You must not do anything with this software that triggers
|
||||
a rule that you cannot or will not follow.
|
||||
|
||||
## Copyright
|
||||
|
||||
Each contributor licenses you to do everything with this
|
||||
software that would otherwise infringe that contributor's
|
||||
copyright in it.
|
||||
|
||||
## Notices
|
||||
|
||||
You must ensure that everyone who gets a copy of
|
||||
any part of this software from you, with or without
|
||||
changes, also gets the text of this license or a link to
|
||||
<https://blueoakcouncil.org/license/1.0.0>.
|
||||
|
||||
## Excuse
|
||||
|
||||
If anyone notifies you in writing that you have not
|
||||
complied with [Notices](#notices), you can keep your
|
||||
license by taking all practical steps to comply within 30
|
||||
days after the notice. If you do not do so, your license
|
||||
ends immediately.
|
||||
|
||||
## Patent
|
||||
|
||||
Each contributor licenses you to do everything with this
|
||||
software that would otherwise infringe any patent claims
|
||||
they can license or become able to license.
|
||||
|
||||
## Reliability
|
||||
|
||||
No contributor can revoke this license.
|
||||
|
||||
## No Liability
|
||||
|
||||
***As far as the law allows, this software comes as is,
|
||||
without any warranty or condition, and no contributor
|
||||
will be liable to anyone for any damages related to this
|
||||
software or this license, under any kind of legal claim.***
|
||||
|
||||
tr46
|
||||
MIT
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
@@ -778,6 +718,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
undici
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) Matteo Collina and Undici contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
universal-user-agent
|
||||
ISC
|
||||
# [ISC License](https://spdx.org/licenses/ISC)
|
||||
@@ -802,47 +767,6 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
webidl-conversions
|
||||
BSD-2-Clause
|
||||
# The BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2014, Domenic Denicola
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
whatwg-url
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015–2016 Sebastian Mayr
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
wrappy
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
2
dist/sourcemap-register.js
vendored
2
dist/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,11 +0,0 @@
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testRunner: 'jest-circus/runner',
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
verbose: true
|
||||
}
|
||||
100
lib/Action.js
100
lib/Action.js
@@ -1,100 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Action = void 0;
|
||||
const GithubError_1 = require("./GithubError");
|
||||
class Action {
|
||||
constructor(inputs, outputs, releases, uploader, artifactDestroyer) {
|
||||
this.inputs = inputs;
|
||||
this.outputs = outputs;
|
||||
this.releases = releases;
|
||||
this.uploader = uploader;
|
||||
this.artifactDestroyer = artifactDestroyer;
|
||||
}
|
||||
perform() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const releaseResponse = yield this.createOrUpdateRelease();
|
||||
const releaseData = releaseResponse.data;
|
||||
const releaseId = releaseData.id;
|
||||
const uploadUrl = releaseData.upload_url;
|
||||
if (this.inputs.removeArtifacts) {
|
||||
yield this.artifactDestroyer.destroyArtifacts(releaseId);
|
||||
}
|
||||
const artifacts = this.inputs.artifacts;
|
||||
if (artifacts.length > 0) {
|
||||
yield this.uploader.uploadArtifacts(artifacts, releaseId, uploadUrl);
|
||||
}
|
||||
this.outputs.applyReleaseData(releaseData);
|
||||
});
|
||||
}
|
||||
createOrUpdateRelease() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.inputs.allowUpdates) {
|
||||
let getResponse;
|
||||
try {
|
||||
getResponse = yield this.releases.getByTag(this.inputs.tag);
|
||||
}
|
||||
catch (error) {
|
||||
return yield this.checkForMissingReleaseError(error);
|
||||
}
|
||||
return yield this.updateRelease(getResponse.data.id);
|
||||
}
|
||||
else {
|
||||
return yield this.createRelease();
|
||||
}
|
||||
});
|
||||
}
|
||||
checkForMissingReleaseError(error) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (Action.noPublishedRelease(error)) {
|
||||
return yield this.updateDraftOrCreateRelease();
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
updateRelease(id) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.updatedDraft, this.inputs.updatedReleaseName, this.inputs.updatedPrerelease);
|
||||
});
|
||||
}
|
||||
static noPublishedRelease(error) {
|
||||
const githubError = new GithubError_1.GithubError(error);
|
||||
return githubError.status == 404;
|
||||
}
|
||||
updateDraftOrCreateRelease() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const draftReleaseId = yield this.findMatchingDraftReleaseId();
|
||||
if (draftReleaseId) {
|
||||
return yield this.updateRelease(draftReleaseId);
|
||||
}
|
||||
else {
|
||||
return yield this.createRelease();
|
||||
}
|
||||
});
|
||||
}
|
||||
findMatchingDraftReleaseId() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const tag = this.inputs.tag;
|
||||
const response = yield this.releases.listReleases();
|
||||
const releases = response.data;
|
||||
const draftRelease = releases.find(release => release.draft && release.tag_name == tag);
|
||||
return draftRelease === null || draftRelease === void 0 ? void 0 : draftRelease.id;
|
||||
});
|
||||
}
|
||||
createRelease() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.createdDraft, this.inputs.generateReleaseNotes, this.inputs.createdReleaseName, this.inputs.createdPrerelease);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Action = Action;
|
||||
@@ -1,19 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Artifact = void 0;
|
||||
const path_1 = require("path");
|
||||
const fs_1 = require("fs");
|
||||
class Artifact {
|
||||
constructor(path, contentType = "raw") {
|
||||
this.path = path;
|
||||
this.name = (0, path_1.basename)(path);
|
||||
this.contentType = contentType;
|
||||
}
|
||||
get contentLength() {
|
||||
return (0, fs_1.statSync)(this.path).size;
|
||||
}
|
||||
readFile() {
|
||||
return (0, fs_1.readFileSync)(this.path);
|
||||
}
|
||||
}
|
||||
exports.Artifact = Artifact;
|
||||
@@ -1,52 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GithubArtifactDestroyer = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
class GithubArtifactDestroyer {
|
||||
constructor(releases) {
|
||||
this.releases = releases;
|
||||
}
|
||||
destroyArtifacts(releaseId) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const releaseAssets = yield this.releases.listArtifactsForRelease(releaseId);
|
||||
for (const artifact of releaseAssets) {
|
||||
const asset = artifact;
|
||||
core.debug(`Deleting existing artifact ${artifact.name}...`);
|
||||
yield this.releases.deleteArtifact(asset.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.GithubArtifactDestroyer = GithubArtifactDestroyer;
|
||||
@@ -1,75 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FileArtifactGlobber = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const Globber_1 = require("./Globber");
|
||||
const Artifact_1 = require("./Artifact");
|
||||
const untildify_1 = __importDefault(require("untildify"));
|
||||
const ArtifactPathValidator_1 = require("./ArtifactPathValidator");
|
||||
class FileArtifactGlobber {
|
||||
constructor(globber = new Globber_1.FileGlobber()) {
|
||||
this.globber = globber;
|
||||
}
|
||||
globArtifactString(artifact, contentType, errorsFailBuild) {
|
||||
const split = /[,\n]/;
|
||||
return artifact.split(split)
|
||||
.map(path => path.trimStart())
|
||||
.map(path => FileArtifactGlobber.expandPath(path))
|
||||
.map(pattern => this.globPattern(pattern, errorsFailBuild))
|
||||
.map((globResult) => FileArtifactGlobber.validatePattern(errorsFailBuild, globResult[1], globResult[0]))
|
||||
.reduce((accumulated, current) => accumulated.concat(current))
|
||||
.map(path => new Artifact_1.Artifact(path, contentType));
|
||||
}
|
||||
globPattern(pattern, errorsFailBuild) {
|
||||
const paths = this.globber.glob(pattern);
|
||||
if (paths.length == 0) {
|
||||
if (errorsFailBuild) {
|
||||
FileArtifactGlobber.throwGlobError(pattern);
|
||||
}
|
||||
else {
|
||||
FileArtifactGlobber.reportGlobWarning(pattern);
|
||||
}
|
||||
}
|
||||
return [pattern, paths];
|
||||
}
|
||||
static validatePattern(errorsFailBuild, paths, pattern) {
|
||||
const validator = new ArtifactPathValidator_1.ArtifactPathValidator(errorsFailBuild, paths, pattern);
|
||||
return validator.validate();
|
||||
}
|
||||
static reportGlobWarning(pattern) {
|
||||
core.warning(`Artifact pattern :${pattern} did not match any files`);
|
||||
}
|
||||
static throwGlobError(pattern) {
|
||||
throw Error(`Artifact pattern :${pattern} did not match any files`);
|
||||
}
|
||||
static expandPath(path) {
|
||||
return (0, untildify_1.default)(path);
|
||||
}
|
||||
}
|
||||
exports.FileArtifactGlobber = FileArtifactGlobber;
|
||||
@@ -1,62 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArtifactPathValidator = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const fs_1 = require("fs");
|
||||
class ArtifactPathValidator {
|
||||
constructor(errorsFailBuild, paths, pattern) {
|
||||
this.paths = paths;
|
||||
this.pattern = pattern;
|
||||
this.errorsFailBuild = errorsFailBuild;
|
||||
}
|
||||
validate() {
|
||||
this.verifyPathsNotEmpty();
|
||||
return this.paths.filter((path) => this.verifyNotDirectory(path));
|
||||
}
|
||||
verifyPathsNotEmpty() {
|
||||
if (this.paths.length == 0) {
|
||||
const message = `Artifact pattern:${this.pattern} did not match any files`;
|
||||
this.reportError(message);
|
||||
}
|
||||
}
|
||||
verifyNotDirectory(path) {
|
||||
const isDir = (0, fs_1.statSync)(path).isDirectory();
|
||||
if (isDir) {
|
||||
const message = `Artifact is a directory:${path}. Directories can not be uploaded to a release.`;
|
||||
this.reportError(message);
|
||||
}
|
||||
return !isDir;
|
||||
}
|
||||
reportError(message) {
|
||||
if (this.errorsFailBuild) {
|
||||
throw Error(message);
|
||||
}
|
||||
else {
|
||||
core.warning(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ArtifactPathValidator = ArtifactPathValidator;
|
||||
@@ -1,92 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GithubArtifactUploader = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
class GithubArtifactUploader {
|
||||
constructor(releases, replacesExistingArtifacts = true, throwsUploadErrors = false) {
|
||||
this.releases = releases;
|
||||
this.replacesExistingArtifacts = replacesExistingArtifacts;
|
||||
this.throwsUploadErrors = throwsUploadErrors;
|
||||
}
|
||||
uploadArtifacts(artifacts, releaseId, uploadUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.replacesExistingArtifacts) {
|
||||
yield this.deleteUpdatedArtifacts(artifacts, releaseId);
|
||||
}
|
||||
for (const artifact of artifacts) {
|
||||
yield this.uploadArtifact(artifact, releaseId, uploadUrl);
|
||||
}
|
||||
});
|
||||
}
|
||||
uploadArtifact(artifact, releaseId, uploadUrl, retry = 3) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
core.debug(`Uploading artifact ${artifact.name}...`);
|
||||
yield this.releases.uploadArtifact(uploadUrl, artifact.contentLength, artifact.contentType, artifact.readFile(), artifact.name, releaseId);
|
||||
}
|
||||
catch (error) {
|
||||
if (error.status >= 500 && retry > 0) {
|
||||
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}. Retrying...`);
|
||||
yield this.uploadArtifact(artifact, releaseId, uploadUrl, retry - 1);
|
||||
}
|
||||
else {
|
||||
if (this.throwsUploadErrors) {
|
||||
throw Error(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
|
||||
}
|
||||
else {
|
||||
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
deleteUpdatedArtifacts(artifacts, releaseId) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const releaseAssets = yield this.releases.listArtifactsForRelease(releaseId);
|
||||
const assetByName = {};
|
||||
releaseAssets.forEach(asset => {
|
||||
assetByName[asset.name] = asset;
|
||||
});
|
||||
for (const artifact of artifacts) {
|
||||
const asset = assetByName[artifact.name];
|
||||
if (asset) {
|
||||
core.debug(`Deleting existing artifact ${artifact.name}...`);
|
||||
yield this.releases.deleteArtifact(asset.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.GithubArtifactUploader = GithubArtifactUploader;
|
||||
@@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GithubError = void 0;
|
||||
const GithubErrorDetail_1 = require("./GithubErrorDetail");
|
||||
class GithubError {
|
||||
constructor(error) {
|
||||
this.error = error;
|
||||
this.githubErrors = this.generateGithubErrors();
|
||||
}
|
||||
generateGithubErrors() {
|
||||
const errors = this.error.errors;
|
||||
if (errors instanceof Array) {
|
||||
return errors.map((err) => new GithubErrorDetail_1.GithubErrorDetail(err));
|
||||
}
|
||||
else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
get status() {
|
||||
return this.error.status;
|
||||
}
|
||||
hasErrorWithCode(code) {
|
||||
return this.githubErrors.some((err) => err.code == code);
|
||||
}
|
||||
toString() {
|
||||
const message = this.error.message;
|
||||
const errors = this.githubErrors;
|
||||
const status = this.status;
|
||||
if (errors.length > 0) {
|
||||
return `Error ${status}: ${message}\nErrors:\n${this.errorBulletedList(errors)}`;
|
||||
}
|
||||
else {
|
||||
return `Error ${status}: ${message}`;
|
||||
}
|
||||
}
|
||||
errorBulletedList(errors) {
|
||||
return errors.map((err) => `- ${err}`).join("\n");
|
||||
}
|
||||
}
|
||||
exports.GithubError = GithubError;
|
||||
@@ -1,57 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GithubErrorDetail = void 0;
|
||||
class GithubErrorDetail {
|
||||
constructor(error) {
|
||||
this.error = error;
|
||||
}
|
||||
get code() {
|
||||
return this.error.code;
|
||||
}
|
||||
toString() {
|
||||
const code = this.error.code;
|
||||
switch (code) {
|
||||
case 'missing':
|
||||
return this.missingResourceMessage();
|
||||
case 'missing_field':
|
||||
return this.missingFieldMessage();
|
||||
case 'invalid':
|
||||
return this.invalidFieldMessage();
|
||||
case 'already_exists':
|
||||
return this.resourceAlreadyExists();
|
||||
default:
|
||||
return this.customErrorMessage();
|
||||
}
|
||||
}
|
||||
customErrorMessage() {
|
||||
const message = this.error.message;
|
||||
const documentation = this.error.documentation_url;
|
||||
let documentationMessage;
|
||||
if (documentation) {
|
||||
documentationMessage = `\nPlease see ${documentation}.`;
|
||||
}
|
||||
else {
|
||||
documentationMessage = "";
|
||||
}
|
||||
return `${message}${documentationMessage}`;
|
||||
}
|
||||
invalidFieldMessage() {
|
||||
const resource = this.error.resource;
|
||||
const field = this.error.field;
|
||||
return `The ${field} field on ${resource} is an invalid format.`;
|
||||
}
|
||||
missingResourceMessage() {
|
||||
const resource = this.error.resource;
|
||||
return `${resource} does not exist.`;
|
||||
}
|
||||
missingFieldMessage() {
|
||||
const resource = this.error.resource;
|
||||
const field = this.error.field;
|
||||
return `The ${field} field on ${resource} is missing.`;
|
||||
}
|
||||
resourceAlreadyExists() {
|
||||
const resource = this.error.resource;
|
||||
return `${resource} already exists.`;
|
||||
}
|
||||
}
|
||||
exports.GithubErrorDetail = GithubErrorDetail;
|
||||
@@ -1,10 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FileGlobber = void 0;
|
||||
const glob_1 = require("glob");
|
||||
class FileGlobber {
|
||||
glob(pattern) {
|
||||
return new glob_1.GlobSync(pattern, { mark: true }).found;
|
||||
}
|
||||
}
|
||||
exports.FileGlobber = FileGlobber;
|
||||
190
lib/Inputs.js
190
lib/Inputs.js
@@ -1,190 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CoreInputs = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const fs_1 = require("fs");
|
||||
class CoreInputs {
|
||||
constructor(artifactGlobber, context) {
|
||||
this.artifactGlobber = artifactGlobber;
|
||||
this.context = context;
|
||||
}
|
||||
get allowUpdates() {
|
||||
const allow = core.getInput('allowUpdates');
|
||||
return allow == 'true';
|
||||
}
|
||||
get artifacts() {
|
||||
let artifacts = core.getInput('artifacts');
|
||||
if (!artifacts) {
|
||||
artifacts = core.getInput('artifact');
|
||||
}
|
||||
if (artifacts) {
|
||||
let contentType = core.getInput('artifactContentType');
|
||||
if (!contentType) {
|
||||
contentType = 'raw';
|
||||
}
|
||||
return this.artifactGlobber
|
||||
.globArtifactString(artifacts, contentType, this.artifactErrorsFailBuild);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
get artifactErrorsFailBuild() {
|
||||
const allow = core.getInput('artifactErrorsFailBuild');
|
||||
return allow == 'true';
|
||||
}
|
||||
get body() {
|
||||
const body = core.getInput('body');
|
||||
if (body) {
|
||||
return body;
|
||||
}
|
||||
const bodyFile = core.getInput('bodyFile');
|
||||
if (bodyFile) {
|
||||
return this.stringFromFile(bodyFile);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
get createdDraft() {
|
||||
const draft = core.getInput('draft');
|
||||
return draft == 'true';
|
||||
}
|
||||
get createdPrerelease() {
|
||||
const preRelease = core.getInput('prerelease');
|
||||
return preRelease == 'true';
|
||||
}
|
||||
get createdReleaseBody() {
|
||||
if (CoreInputs.omitBody)
|
||||
return undefined;
|
||||
return this.body;
|
||||
}
|
||||
static get omitBody() {
|
||||
return core.getInput('omitBody') == 'true';
|
||||
}
|
||||
get createdReleaseName() {
|
||||
if (CoreInputs.omitName)
|
||||
return undefined;
|
||||
return this.name;
|
||||
}
|
||||
static get omitName() {
|
||||
return core.getInput('omitName') == 'true';
|
||||
}
|
||||
get commit() {
|
||||
const commit = core.getInput('commit');
|
||||
if (commit) {
|
||||
return commit;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
get discussionCategory() {
|
||||
const category = core.getInput('discussionCategory');
|
||||
if (category) {
|
||||
return category;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
get name() {
|
||||
const name = core.getInput('name');
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
return this.tag;
|
||||
}
|
||||
get generateReleaseNotes() {
|
||||
const generate = core.getInput('generateReleaseNotes');
|
||||
return generate == 'true';
|
||||
}
|
||||
get owner() {
|
||||
let owner = core.getInput('owner');
|
||||
if (owner) {
|
||||
return owner;
|
||||
}
|
||||
return this.context.repo.owner;
|
||||
}
|
||||
get removeArtifacts() {
|
||||
const removes = core.getInput('removeArtifacts');
|
||||
return removes == 'true';
|
||||
}
|
||||
get replacesArtifacts() {
|
||||
const replaces = core.getInput('replacesArtifacts');
|
||||
return replaces == 'true';
|
||||
}
|
||||
get repo() {
|
||||
let repo = core.getInput('repo');
|
||||
if (repo) {
|
||||
return repo;
|
||||
}
|
||||
return this.context.repo.repo;
|
||||
}
|
||||
get tag() {
|
||||
const tag = core.getInput('tag');
|
||||
if (tag) {
|
||||
return tag;
|
||||
}
|
||||
const ref = this.context.ref;
|
||||
const tagPath = "refs/tags/";
|
||||
if (ref && ref.startsWith(tagPath)) {
|
||||
return ref.substr(tagPath.length, ref.length);
|
||||
}
|
||||
throw Error("No tag found in ref or input!");
|
||||
}
|
||||
get token() {
|
||||
return core.getInput('token', { required: true });
|
||||
}
|
||||
get updatedDraft() {
|
||||
if (CoreInputs.omitDraftDuringUpdate)
|
||||
return undefined;
|
||||
return this.createdDraft;
|
||||
}
|
||||
static get omitDraftDuringUpdate() {
|
||||
return core.getInput('omitDraftDuringUpdate') == 'true';
|
||||
}
|
||||
get updatedPrerelease() {
|
||||
if (CoreInputs.omitPrereleaseDuringUpdate)
|
||||
return undefined;
|
||||
return this.createdPrerelease;
|
||||
}
|
||||
static get omitPrereleaseDuringUpdate() {
|
||||
return core.getInput('omitPrereleaseDuringUpdate') == 'true';
|
||||
}
|
||||
get updatedReleaseBody() {
|
||||
if (CoreInputs.omitBody || CoreInputs.omitBodyDuringUpdate)
|
||||
return undefined;
|
||||
return this.body;
|
||||
}
|
||||
static get omitBodyDuringUpdate() {
|
||||
return core.getInput('omitBodyDuringUpdate') == 'true';
|
||||
}
|
||||
get updatedReleaseName() {
|
||||
if (CoreInputs.omitName || CoreInputs.omitNameDuringUpdate)
|
||||
return undefined;
|
||||
return this.name;
|
||||
}
|
||||
static get omitNameDuringUpdate() {
|
||||
return core.getInput('omitNameDuringUpdate') == 'true';
|
||||
}
|
||||
stringFromFile(path) {
|
||||
return (0, fs_1.readFileSync)(path, 'utf-8');
|
||||
}
|
||||
}
|
||||
exports.CoreInputs = CoreInputs;
|
||||
69
lib/Main.js
69
lib/Main.js
@@ -1,69 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const github = __importStar(require("@actions/github"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const Inputs_1 = require("./Inputs");
|
||||
const Releases_1 = require("./Releases");
|
||||
const Action_1 = require("./Action");
|
||||
const ArtifactUploader_1 = require("./ArtifactUploader");
|
||||
const ArtifactGlobber_1 = require("./ArtifactGlobber");
|
||||
const GithubError_1 = require("./GithubError");
|
||||
const Outputs_1 = require("./Outputs");
|
||||
const ArtifactDestroyer_1 = require("./ArtifactDestroyer");
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const action = createAction();
|
||||
yield action.perform();
|
||||
}
|
||||
catch (error) {
|
||||
const githubError = new GithubError_1.GithubError(error);
|
||||
core.setFailed(githubError.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
function createAction() {
|
||||
const token = core.getInput('token');
|
||||
const context = github.context;
|
||||
const git = github.getOctokit(token);
|
||||
const globber = new ArtifactGlobber_1.FileArtifactGlobber();
|
||||
const inputs = new Inputs_1.CoreInputs(globber, context);
|
||||
const outputs = new Outputs_1.CoreOutputs();
|
||||
const releases = new Releases_1.GithubReleases(inputs, git);
|
||||
const uploader = new ArtifactUploader_1.GithubArtifactUploader(releases, inputs.replacesArtifacts, inputs.artifactErrorsFailBuild);
|
||||
const artifactDestroyer = new ArtifactDestroyer_1.GithubArtifactDestroyer(releases);
|
||||
return new Action_1.Action(inputs, outputs, releases, uploader, artifactDestroyer);
|
||||
}
|
||||
run();
|
||||
@@ -1,35 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CoreOutputs = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
class CoreOutputs {
|
||||
applyReleaseData(releaseData) {
|
||||
core.setOutput('id', releaseData.id);
|
||||
core.setOutput('html_url', releaseData.html_url);
|
||||
core.setOutput('upload_url', releaseData.upload_url);
|
||||
}
|
||||
}
|
||||
exports.CoreOutputs = CoreOutputs;
|
||||
104
lib/Releases.js
104
lib/Releases.js
@@ -1,104 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GithubReleases = void 0;
|
||||
class GithubReleases {
|
||||
constructor(inputs, git) {
|
||||
this.inputs = inputs;
|
||||
this.git = git;
|
||||
}
|
||||
create(tag, body, commitHash, discussionCategory, draft, generateReleaseNotes, name, prerelease) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// noinspection TypeScriptValidateJSTypes
|
||||
return this.git.rest.repos.createRelease({
|
||||
body: body,
|
||||
name: name,
|
||||
discussion_category_name: discussionCategory,
|
||||
draft: draft,
|
||||
generate_release_notes: generateReleaseNotes,
|
||||
owner: this.inputs.owner,
|
||||
prerelease: prerelease,
|
||||
repo: this.inputs.repo,
|
||||
target_commitish: commitHash,
|
||||
tag_name: tag
|
||||
});
|
||||
});
|
||||
}
|
||||
deleteArtifact(assetId) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return this.git.rest.repos.deleteReleaseAsset({
|
||||
asset_id: assetId,
|
||||
owner: this.inputs.owner,
|
||||
repo: this.inputs.repo
|
||||
});
|
||||
});
|
||||
}
|
||||
getByTag(tag) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return this.git.rest.repos.getReleaseByTag({
|
||||
owner: this.inputs.owner,
|
||||
repo: this.inputs.repo,
|
||||
tag: tag
|
||||
});
|
||||
});
|
||||
}
|
||||
listArtifactsForRelease(releaseId) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return this.git.paginate(this.git.rest.repos.listReleaseAssets, {
|
||||
owner: this.inputs.owner,
|
||||
release_id: releaseId,
|
||||
repo: this.inputs.repo
|
||||
});
|
||||
});
|
||||
}
|
||||
listReleases() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return this.git.rest.repos.listReleases({
|
||||
owner: this.inputs.owner,
|
||||
repo: this.inputs.repo
|
||||
});
|
||||
});
|
||||
}
|
||||
update(id, tag, body, commitHash, discussionCategory, draft, name, prerelease) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// noinspection TypeScriptValidateJSTypes
|
||||
return this.git.rest.repos.updateRelease({
|
||||
release_id: id,
|
||||
body: body,
|
||||
name: name,
|
||||
discussion_category_name: discussionCategory,
|
||||
draft: draft,
|
||||
owner: this.inputs.owner,
|
||||
prerelease: prerelease,
|
||||
repo: this.inputs.repo,
|
||||
target_commitish: commitHash,
|
||||
tag_name: tag
|
||||
});
|
||||
});
|
||||
}
|
||||
uploadArtifact(assetUrl, contentLength, contentType, file, name, releaseId) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return this.git.rest.repos.uploadReleaseAsset({
|
||||
url: assetUrl,
|
||||
headers: {
|
||||
"content-length": contentLength,
|
||||
"content-type": contentType
|
||||
},
|
||||
data: file,
|
||||
name: name,
|
||||
owner: this.inputs.owner,
|
||||
release_id: releaseId,
|
||||
repo: this.inputs.repo
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.GithubReleases = GithubReleases;
|
||||
54
package.json
54
package.json
@@ -24,19 +24,53 @@
|
||||
],
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"jest": {
|
||||
"clearMocks": true,
|
||||
"collectCoverage": true,
|
||||
"coveragePathIgnorePatterns": [
|
||||
"src/Globber.ts",
|
||||
"src/Releases.ts"
|
||||
],
|
||||
"coverageThreshold": {
|
||||
"global": {
|
||||
"branches": 95,
|
||||
"functions": 100,
|
||||
"lines": 100,
|
||||
"statements": 100
|
||||
}
|
||||
},
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"ts"
|
||||
],
|
||||
"testEnvironment": "node",
|
||||
"testMatch": [
|
||||
"**/*.test.ts"
|
||||
],
|
||||
"testRunner": "jest-circus/runner",
|
||||
"transform": {
|
||||
"^.+\\.ts$": "ts-jest"
|
||||
},
|
||||
"verbose": true
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"@types/glob": "^7.2.0",
|
||||
"glob": "^7.2.0",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@types/node": "^22.10.3",
|
||||
"glob": "^11.0.0",
|
||||
"untildify": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/node": "^17.0.21",
|
||||
"jest": "^27.5.1",
|
||||
"jest-circus": "^27.5.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
"typescript": "^4.6.3"
|
||||
"@types/jest": "^29.5.14",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"ts-jest": "^29.2.5",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"jest-cli/yargs": "^17.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as core from '@actions/core';
|
||||
import {Inputs} from "./Inputs";
|
||||
import {
|
||||
CreateOrUpdateReleaseResponse,
|
||||
@@ -10,27 +11,40 @@ import {ArtifactUploader} from "./ArtifactUploader";
|
||||
import {GithubError} from "./GithubError";
|
||||
import {Outputs} from "./Outputs";
|
||||
import {ArtifactDestroyer} from "./ArtifactDestroyer";
|
||||
import {ReleaseValidator} from "./ReleaseValidator";
|
||||
import {ActionSkipper} from "./ActionSkipper";
|
||||
|
||||
export class Action {
|
||||
private inputs: Inputs
|
||||
private outputs: Outputs
|
||||
private releases: Releases
|
||||
private artifactDestroyer: ArtifactDestroyer
|
||||
private uploader: ArtifactUploader
|
||||
private artifactDestroyer: ArtifactDestroyer
|
||||
private skipper: ActionSkipper
|
||||
|
||||
private releaseValidator: ReleaseValidator
|
||||
|
||||
constructor(inputs: Inputs,
|
||||
outputs: Outputs,
|
||||
releases: Releases,
|
||||
uploader: ArtifactUploader,
|
||||
artifactDestroyer: ArtifactDestroyer) {
|
||||
artifactDestroyer: ArtifactDestroyer,
|
||||
skipper: ActionSkipper) {
|
||||
this.inputs = inputs
|
||||
this.outputs = outputs
|
||||
this.releases = releases
|
||||
this.uploader = uploader
|
||||
this.artifactDestroyer = artifactDestroyer
|
||||
this.skipper = skipper
|
||||
this.releaseValidator = new ReleaseValidator(inputs.updateOnlyUnreleased)
|
||||
}
|
||||
|
||||
async perform() {
|
||||
if (await this.skipper.shouldSkip()) {
|
||||
core.notice("Skipping action, release already exists and skipIfReleaseExists is enabled.")
|
||||
return
|
||||
}
|
||||
|
||||
const releaseResponse = await this.createOrUpdateRelease();
|
||||
const releaseData = releaseResponse.data
|
||||
const releaseId = releaseData.id
|
||||
@@ -56,6 +70,9 @@ export class Action {
|
||||
} catch (error: any) {
|
||||
return await this.checkForMissingReleaseError(error)
|
||||
}
|
||||
|
||||
// Fail if this isn't an unreleased release & updateOnlyUnreleased is enabled.
|
||||
this.releaseValidator.validateReleaseUpdate(getResponse.data)
|
||||
|
||||
return await this.updateRelease(getResponse.data.id)
|
||||
} else {
|
||||
@@ -79,6 +96,7 @@ export class Action {
|
||||
this.inputs.commit,
|
||||
this.inputs.discussionCategory,
|
||||
this.inputs.updatedDraft,
|
||||
this.inputs.makeLatest,
|
||||
this.inputs.updatedReleaseName,
|
||||
this.inputs.updatedPrerelease
|
||||
)
|
||||
@@ -102,6 +120,10 @@ export class Action {
|
||||
const tag = this.inputs.tag
|
||||
const response = await this.releases.listReleases()
|
||||
const releases = response.data
|
||||
if(!releases) {
|
||||
throw new Error(`No releases found. Response: ${JSON.stringify(response)}`)
|
||||
}
|
||||
|
||||
const draftRelease = releases.find(release => release.draft && release.tag_name == tag)
|
||||
|
||||
return draftRelease?.id
|
||||
@@ -115,6 +137,7 @@ export class Action {
|
||||
this.inputs.discussionCategory,
|
||||
this.inputs.createdDraft,
|
||||
this.inputs.generateReleaseNotes,
|
||||
this.inputs.makeLatest,
|
||||
this.inputs.createdReleaseName,
|
||||
this.inputs.createdPrerelease
|
||||
)
|
||||
|
||||
27
src/ActionSkipper.ts
Normal file
27
src/ActionSkipper.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import {Releases} from "./Releases";
|
||||
|
||||
export interface ActionSkipper {
|
||||
shouldSkip(): Promise<boolean>
|
||||
}
|
||||
|
||||
export class ReleaseActionSkipper {
|
||||
constructor(private skipIfReleaseExists: boolean,
|
||||
private releases: Releases,
|
||||
private tag: string) {
|
||||
}
|
||||
|
||||
async shouldSkip(): Promise<boolean> {
|
||||
if (!this.skipIfReleaseExists) {
|
||||
// Bail if skip flag isn't set.
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const getResponse = await this.releases.getByTag(this.tag)
|
||||
return getResponse.data != null
|
||||
} catch (error: any) {
|
||||
// There is either no release or something else went wrong. Either way, run the action.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { basename } from "path";
|
||||
import { readFileSync, statSync } from "fs";
|
||||
import {createReadStream, readFileSync, ReadStream, statSync} from "fs";
|
||||
|
||||
export class Artifact {
|
||||
readonly contentType: string
|
||||
@@ -16,7 +16,7 @@ export class Artifact {
|
||||
return statSync(this.path).size
|
||||
}
|
||||
|
||||
readFile(): Buffer {
|
||||
return readFileSync(this.path)
|
||||
readFile(): ReadStream {
|
||||
return createReadStream(this.path)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import {Globber, FileGlobber} from "./Globber";
|
||||
import {Artifact} from "./Artifact";
|
||||
import untildify from "untildify";
|
||||
import {ArtifactPathValidator} from "./ArtifactPathValidator";
|
||||
import {PathNormalizer} from "./PathNormalizer";
|
||||
|
||||
export interface ArtifactGlobber {
|
||||
globArtifactString(artifact: string, contentType: string, errorsFailBuild: boolean): Artifact[]
|
||||
@@ -19,6 +20,7 @@ export class FileArtifactGlobber implements ArtifactGlobber {
|
||||
const split = /[,\n]/
|
||||
return artifact.split(split)
|
||||
.map(path => path.trimStart())
|
||||
.map(path => PathNormalizer.normalizePath(path))
|
||||
.map(path => FileArtifactGlobber.expandPath(path))
|
||||
.map(pattern => this.globPattern(pattern, errorsFailBuild))
|
||||
.map((globResult) => FileArtifactGlobber.validatePattern(errorsFailBuild, globResult[1], globResult[0]))
|
||||
|
||||
@@ -31,14 +31,21 @@ export class GithubError {
|
||||
const errors = this.githubErrors
|
||||
const status = this.status
|
||||
if (errors.length > 0) {
|
||||
return `Error ${status}: ${message}\nErrors:\n${this.errorBulletedList(errors)}`
|
||||
return `Error ${status}: ${message}\nErrors:\n${this.errorBulletedList(errors)}${this.remediation()}`
|
||||
} else {
|
||||
return `Error ${status}: ${message}`
|
||||
return `Error ${status}: ${message}${this.remediation()}`
|
||||
}
|
||||
}
|
||||
|
||||
private errorBulletedList(errors: GithubErrorDetail[]): string {
|
||||
return errors.map((err) => `- ${err}`).join("\n")
|
||||
}
|
||||
|
||||
private remediation(): String {
|
||||
if (this.status == 404) {
|
||||
return "\nMake sure your github token has access to the repo and has permission to author releases"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { GlobSync } from "glob";
|
||||
import {globSync} from "glob";
|
||||
|
||||
|
||||
export interface Globber {
|
||||
glob(pattern: string): string[]
|
||||
@@ -6,6 +7,6 @@ export interface Globber {
|
||||
|
||||
export class FileGlobber implements Globber {
|
||||
glob(pattern: string): string[] {
|
||||
return new GlobSync(pattern, { mark: true }).found
|
||||
return globSync(pattern, { mark: true })
|
||||
}
|
||||
}
|
||||
@@ -15,16 +15,19 @@ export interface Inputs {
|
||||
readonly createdReleaseName?: string
|
||||
readonly discussionCategory?: string
|
||||
readonly generateReleaseNotes: boolean
|
||||
readonly makeLatest?: "legacy" | "true" | "false" | undefined
|
||||
readonly owner: string
|
||||
readonly removeArtifacts: boolean
|
||||
readonly replacesArtifacts: boolean
|
||||
readonly repo: string
|
||||
readonly skipIfReleaseExists: boolean
|
||||
readonly tag: string
|
||||
readonly token: string
|
||||
readonly updatedDraft?: boolean
|
||||
readonly updatedReleaseBody?: string
|
||||
readonly updatedReleaseName?: string
|
||||
readonly updatedPrerelease?: boolean
|
||||
readonly updateOnlyUnreleased: boolean
|
||||
}
|
||||
|
||||
export class CoreInputs implements Inputs {
|
||||
@@ -128,12 +131,21 @@ export class CoreInputs implements Inputs {
|
||||
|
||||
return this.tag
|
||||
}
|
||||
|
||||
|
||||
get generateReleaseNotes(): boolean {
|
||||
const generate = core.getInput('generateReleaseNotes')
|
||||
return generate == 'true'
|
||||
}
|
||||
|
||||
get makeLatest(): "legacy" | "true" | "false" | undefined {
|
||||
let latest = core.getInput('makeLatest')
|
||||
if (latest == "true" || latest == "false" || latest == "legacy") {
|
||||
return latest;
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
get owner(): string {
|
||||
let owner = core.getInput('owner')
|
||||
if (owner) {
|
||||
@@ -141,11 +153,12 @@ export class CoreInputs implements Inputs {
|
||||
}
|
||||
return this.context.repo.owner
|
||||
}
|
||||
|
||||
|
||||
get removeArtifacts(): boolean {
|
||||
const removes = core.getInput('removeArtifacts')
|
||||
return removes == 'true'
|
||||
}
|
||||
|
||||
get replacesArtifacts(): boolean {
|
||||
const replaces = core.getInput('replacesArtifacts')
|
||||
return replaces == 'true'
|
||||
@@ -159,6 +172,10 @@ export class CoreInputs implements Inputs {
|
||||
return this.context.repo.repo
|
||||
}
|
||||
|
||||
get skipIfReleaseExists(): boolean {
|
||||
return core.getBooleanInput("skipIfReleaseExists")
|
||||
}
|
||||
|
||||
get tag(): string {
|
||||
const tag = core.getInput('tag')
|
||||
if (tag) {
|
||||
@@ -186,7 +203,7 @@ export class CoreInputs implements Inputs {
|
||||
private static get omitDraftDuringUpdate(): boolean {
|
||||
return core.getInput('omitDraftDuringUpdate') == 'true'
|
||||
}
|
||||
|
||||
|
||||
get updatedPrerelease(): boolean | undefined {
|
||||
if (CoreInputs.omitPrereleaseDuringUpdate) return undefined
|
||||
return this.createdPrerelease
|
||||
@@ -210,6 +227,10 @@ export class CoreInputs implements Inputs {
|
||||
return this.name
|
||||
}
|
||||
|
||||
get updateOnlyUnreleased(): boolean {
|
||||
return core.getInput('updateOnlyUnreleased') == 'true'
|
||||
}
|
||||
|
||||
private static get omitNameDuringUpdate(): boolean {
|
||||
return core.getInput('omitNameDuringUpdate') == 'true'
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {FileArtifactGlobber} from './ArtifactGlobber';
|
||||
import {GithubError} from './GithubError';
|
||||
import {CoreOutputs} from "./Outputs";
|
||||
import {GithubArtifactDestroyer} from "./ArtifactDestroyer";
|
||||
import {ActionSkipper, ReleaseActionSkipper} from "./ActionSkipper";
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
@@ -28,10 +29,11 @@ function createAction(): Action {
|
||||
const inputs = new CoreInputs(globber, context)
|
||||
const outputs = new CoreOutputs()
|
||||
const releases = new GithubReleases(inputs, git)
|
||||
const skipper = new ReleaseActionSkipper(inputs.skipIfReleaseExists, releases, inputs.tag)
|
||||
const uploader = new GithubArtifactUploader(releases, inputs.replacesArtifacts, inputs.artifactErrorsFailBuild)
|
||||
const artifactDestroyer = new GithubArtifactDestroyer(releases)
|
||||
|
||||
return new Action(inputs, outputs, releases, uploader, artifactDestroyer)
|
||||
return new Action(inputs, outputs, releases, uploader, artifactDestroyer, skipper)
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
7
src/PathNormalizer.ts
Normal file
7
src/PathNormalizer.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import path from "path";
|
||||
|
||||
export class PathNormalizer {
|
||||
static normalizePath(pathString: string): string {
|
||||
return pathString.split(path.sep).join("/")
|
||||
}
|
||||
}
|
||||
20
src/ReleaseValidator.ts
Normal file
20
src/ReleaseValidator.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export class ReleaseValidator {
|
||||
constructor(private updateOnlyUnreleased: boolean) {
|
||||
}
|
||||
|
||||
validateReleaseUpdate(releaseResponse: ReleaseStageArguments) {
|
||||
if (!this.updateOnlyUnreleased) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!releaseResponse.draft && !releaseResponse.prerelease) {
|
||||
throw new Error(`Tried to update "${releaseResponse.name ?? "release"}" which is neither a draft or prerelease. (updateOnlyUnreleased is on)`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type ReleaseStageArguments = {
|
||||
draft: boolean
|
||||
name: string | null
|
||||
prerelease: boolean
|
||||
}
|
||||
@@ -25,6 +25,7 @@ export interface Releases {
|
||||
discussionCategory?: string,
|
||||
draft?: boolean,
|
||||
generateReleaseNotes?: boolean,
|
||||
makeLatest?: "legacy" | "true" | "false" | undefined,
|
||||
name?: string,
|
||||
prerelease?: boolean
|
||||
): Promise<CreateReleaseResponse>
|
||||
@@ -44,6 +45,7 @@ export interface Releases {
|
||||
commitHash?: string,
|
||||
discussionCategory?: string,
|
||||
draft?: boolean,
|
||||
makeLatest?: "legacy" | "true" | "false" | undefined,
|
||||
name?: string,
|
||||
prerelease?: boolean
|
||||
): Promise<UpdateReleaseResponse>
|
||||
@@ -74,6 +76,7 @@ export class GithubReleases implements Releases {
|
||||
discussionCategory?: string,
|
||||
draft?: boolean,
|
||||
generateReleaseNotes?: boolean,
|
||||
makeLatest?: "legacy" | "true" | "false" | undefined,
|
||||
name?: string,
|
||||
prerelease?: boolean
|
||||
): Promise<CreateReleaseResponse> {
|
||||
@@ -84,6 +87,7 @@ export class GithubReleases implements Releases {
|
||||
discussion_category_name: discussionCategory,
|
||||
draft: draft,
|
||||
generate_release_notes: generateReleaseNotes,
|
||||
make_latest: makeLatest,
|
||||
owner: this.inputs.owner,
|
||||
prerelease: prerelease,
|
||||
repo: this.inputs.repo,
|
||||
@@ -134,6 +138,7 @@ export class GithubReleases implements Releases {
|
||||
commitHash?: string,
|
||||
discussionCategory?: string,
|
||||
draft?: boolean,
|
||||
makeLatest?: "legacy" | "true" | "false" | undefined,
|
||||
name?: string,
|
||||
prerelease?: boolean
|
||||
): Promise<UpdateReleaseResponse> {
|
||||
@@ -144,6 +149,7 @@ export class GithubReleases implements Releases {
|
||||
name: name,
|
||||
discussion_category_name: discussionCategory,
|
||||
draft: draft,
|
||||
make_latest: makeLatest,
|
||||
owner: this.inputs.owner,
|
||||
prerelease: prerelease,
|
||||
repo: this.inputs.repo,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2015", /* 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'. */
|
||||
"moduleResolution": "node",
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"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. */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"skipLibCheck": true,
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user