mirror of
https://github.com/actions/publish-action.git
synced 2026-01-13 22:49:02 +08:00
Compare commits
13 Commits
v0.2.2
...
Permission
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d0a8ceaea | ||
|
|
0a555c8d11 | ||
|
|
0f919ea818 | ||
|
|
f784495ce7 | ||
|
|
7ea110f150 | ||
|
|
e8908aab06 | ||
|
|
337dee4c7b | ||
|
|
740c66cdc2 | ||
|
|
e9810b12c0 | ||
|
|
e7e3b5daf5 | ||
|
|
3f069f6e86 | ||
|
|
9169aa7609 | ||
|
|
87579b14ff |
6
.eslintignore
Normal file
6
.eslintignore
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Ignore list
|
||||||
|
/*
|
||||||
|
|
||||||
|
# Do not ignore these folders:
|
||||||
|
!__tests__/
|
||||||
|
!src/
|
||||||
51
.eslintrc.js
Normal file
51
.eslintrc.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
||||||
|
module.exports = {
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:eslint-plugin-jest/recommended',
|
||||||
|
'eslint-config-prettier'
|
||||||
|
],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
plugins: ['@typescript-eslint', 'eslint-plugin-node', 'eslint-plugin-jest'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-require-imports': 'error',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'@typescript-eslint/ban-ts-comment': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'ts-ignore': 'allow-with-description'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-console': 'error',
|
||||||
|
'yoda': 'error',
|
||||||
|
'prefer-const': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
destructuring: 'all'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-control-regex': 'off',
|
||||||
|
'no-constant-condition': ['error', {checkLoops: false}],
|
||||||
|
'node/no-extraneous-import': 'error'
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/*{test,spec}.ts'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'jest/no-standalone-expect': 'off',
|
||||||
|
'jest/no-conditional-expect': 'off',
|
||||||
|
'no-console': 'off',
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
es6: true,
|
||||||
|
'jest/globals': true
|
||||||
|
}
|
||||||
|
};
|
||||||
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
.licenses/** -diff linguist-generated=true
|
||||||
2
.github/workflows/basic-validation.yml
vendored
2
.github/workflows/basic-validation.yml
vendored
@@ -10,3 +10,5 @@ jobs:
|
|||||||
call-basic-validation:
|
call-basic-validation:
|
||||||
name: Basic validation
|
name: Basic validation
|
||||||
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
|
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
|||||||
2
.github/workflows/check-dist.yml
vendored
2
.github/workflows/check-dist.yml
vendored
@@ -15,3 +15,5 @@ jobs:
|
|||||||
call-check-dist:
|
call-check-dist:
|
||||||
name: Check dist/
|
name: Check dist/
|
||||||
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
|||||||
4
.github/workflows/codeql-analysis.yml
vendored
4
.github/workflows/codeql-analysis.yml
vendored
@@ -2,9 +2,9 @@ name: CodeQL analysis
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [main]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 3 * * 0'
|
- cron: '0 3 * * 0'
|
||||||
|
|
||||||
|
|||||||
14
.github/workflows/release-new-action-version.yml
vendored
14
.github/workflows/release-new-action-version.yml
vendored
@@ -25,11 +25,11 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Update the ${{ env.TAG_NAME }} tag
|
- name: Update the ${{ env.TAG_NAME }} tag
|
||||||
id: update-major-tag
|
id: update-major-tag
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
source-tag: ${{ env.TAG_NAME }}
|
source-tag: ${{ env.TAG_NAME }}
|
||||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
|
|||||||
11
.github/workflows/update-config-files.yml
vendored
Normal file
11
.github/workflows/update-config-files.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
name: Update configuration files
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 3 * * 0'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
call-update-configuration-files:
|
||||||
|
name: Update configuration files
|
||||||
|
uses: actions/reusable-workflows/.github/workflows/update-config-files.yml@main
|
||||||
2
.licenses/npm/@actions/core.dep.yml
generated
2
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/core"
|
name: "@actions/core"
|
||||||
version: 1.10.0
|
version: 1.10.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions core lib
|
summary: Actions core lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||||
|
|||||||
30
.licenses/npm/@actions/github.dep.yml
generated
30
.licenses/npm/@actions/github.dep.yml
generated
@@ -1,30 +1,20 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/github"
|
name: "@actions/github"
|
||||||
version: 4.0.0
|
version: 6.0.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions github lib
|
summary: Actions github lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/master/packages/github
|
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: Auto-generated MIT license text
|
- sources: LICENSE.md
|
||||||
text: |
|
text: |-
|
||||||
MIT License
|
The MIT License (MIT)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Copyright 2019 GitHub
|
||||||
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
|
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:
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
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.
|
||||||
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.
|
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
32
.licenses/npm/@actions/http-client-1.0.11.dep.yml
generated
32
.licenses/npm/@actions/http-client-1.0.11.dep.yml
generated
@@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
name: "@actions/http-client"
|
|
||||||
version: 1.0.11
|
|
||||||
type: npm
|
|
||||||
summary: Actions Http Client
|
|
||||||
homepage: https://github.com/actions/http-client#readme
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE
|
|
||||||
text: |
|
|
||||||
Actions Http Client for Node.js
|
|
||||||
|
|
||||||
Copyright (c) GitHub, Inc.
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
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.
|
|
||||||
notices: []
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/http-client"
|
name: "@actions/http-client"
|
||||||
version: 2.0.1
|
version: 2.2.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions Http Client
|
summary: Actions Http Client
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||||
@@ -1,22 +1,20 @@
|
|||||||
---
|
---
|
||||||
name: whatwg-url
|
name: "@fastify/busboy"
|
||||||
version: 5.0.0
|
version: 2.1.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: An implementation of the WHATWG URL Standard's URL API and parsing machinery
|
summary: A streaming parser for HTML form data for node.js
|
||||||
homepage:
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.txt
|
- sources: LICENSE
|
||||||
text: |
|
text: |-
|
||||||
The MIT License (MIT)
|
Copyright Brian White. All rights reserved.
|
||||||
|
|
||||||
Copyright (c) 2015–2016 Sebastian Mayr
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to
|
||||||
in the Software without restriction, including without limitation the rights
|
deal in the Software without restriction, including without limitation the
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
sell copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
@@ -26,7 +24,7 @@ licenses:
|
|||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
THE SOFTWARE.
|
IN THE SOFTWARE.
|
||||||
notices: []
|
notices: []
|
||||||
4
.licenses/npm/@octokit/auth-token.dep.yml
generated
4
.licenses/npm/@octokit/auth-token.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/auth-token"
|
name: "@octokit/auth-token"
|
||||||
version: 2.4.5
|
version: 4.0.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: GitHub API token authentication for browsers and Node.js
|
summary: GitHub API token authentication for browsers and Node.js
|
||||||
homepage: https://github.com/octokit/auth-token.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
4
.licenses/npm/@octokit/core.dep.yml
generated
4
.licenses/npm/@octokit/core.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/core"
|
name: "@octokit/core"
|
||||||
version: 3.4.0
|
version: 5.0.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Extendable client for GitHub's REST & GraphQL APIs
|
summary: Extendable client for GitHub's REST & GraphQL APIs
|
||||||
homepage: https://github.com/octokit/core.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
4
.licenses/npm/@octokit/endpoint.dep.yml
generated
4
.licenses/npm/@octokit/endpoint.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/endpoint"
|
name: "@octokit/endpoint"
|
||||||
version: 6.0.11
|
version: 9.0.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: Turns REST API endpoints into generic request options
|
summary: Turns REST API endpoints into generic request options
|
||||||
homepage: https://github.com/octokit/endpoint.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
4
.licenses/npm/@octokit/graphql.dep.yml
generated
4
.licenses/npm/@octokit/graphql.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/graphql"
|
name: "@octokit/graphql"
|
||||||
version: 4.6.1
|
version: 7.0.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: GitHub GraphQL API client for browsers and Node
|
summary: GitHub GraphQL API client for browsers and Node
|
||||||
homepage: https://github.com/octokit/graphql.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
6
.licenses/npm/@octokit/openapi-types.dep.yml
generated
6
.licenses/npm/@octokit/openapi-types.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/openapi-types"
|
name: "@octokit/openapi-types"
|
||||||
version: 7.0.0
|
version: 19.0.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Generated TypeScript definitions based on GitHub's OpenAPI spec
|
summary: Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com
|
||||||
homepage: https://github.com/octokit/openapi-types.ts#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/plugin-paginate-rest"
|
name: "@octokit/plugin-paginate-rest"
|
||||||
version: 2.13.3
|
version: 9.1.4
|
||||||
type: npm
|
type: npm
|
||||||
summary: Octokit plugin to paginate REST API endpoint responses
|
summary: Octokit plugin to paginate REST API endpoint responses
|
||||||
homepage: https://github.com/octokit/plugin-paginate-rest.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/plugin-rest-endpoint-methods"
|
name: "@octokit/plugin-rest-endpoint-methods"
|
||||||
version: 4.15.1
|
version: 10.1.5
|
||||||
type: npm
|
type: npm
|
||||||
summary: Octokit plugin adding one method for all of api.github.com REST API endpoints
|
summary: Octokit plugin adding one method for all of api.github.com REST API endpoints
|
||||||
homepage: https://github.com/octokit/plugin-rest-endpoint-methods.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
4
.licenses/npm/@octokit/request-error.dep.yml
generated
4
.licenses/npm/@octokit/request-error.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/request-error"
|
name: "@octokit/request-error"
|
||||||
version: 2.0.5
|
version: 5.0.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Error class for Octokit request errors
|
summary: Error class for Octokit request errors
|
||||||
homepage: https://github.com/octokit/request-error.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
8
.licenses/npm/@octokit/request.dep.yml
generated
8
.licenses/npm/@octokit/request.dep.yml
generated
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/request"
|
name: "@octokit/request"
|
||||||
version: 5.4.15
|
version: 8.1.6
|
||||||
type: npm
|
type: npm
|
||||||
summary: "Send parameterized requests to GitHubâ\x80\x99s APIs with sensible defaults
|
summary: Send parameterized requests to GitHub's APIs with sensible defaults in browsers
|
||||||
in browsers and Node"
|
and Node
|
||||||
homepage: https://github.com/octokit/request.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
4
.licenses/npm/@octokit/types.dep.yml
generated
4
.licenses/npm/@octokit/types.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/types"
|
name: "@octokit/types"
|
||||||
version: 6.14.2
|
version: 12.3.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Shared TypeScript definitions for Octokit projects
|
summary: Shared TypeScript definitions for Octokit projects
|
||||||
homepage: https://github.com/octokit/types.ts#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
4
.licenses/npm/before-after-hook.dep.yml
generated
4
.licenses/npm/before-after-hook.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: before-after-hook
|
name: before-after-hook
|
||||||
version: 2.2.1
|
version: 2.2.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: asynchronous before/error/after hooks for internal functionality
|
summary: asynchronous before/error/after hooks for internal functionality
|
||||||
homepage: https://github.com/gr2m/before-after-hook#readme
|
homepage:
|
||||||
license: apache-2.0
|
license: apache-2.0
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
40
.licenses/npm/is-plain-object.dep.yml
generated
40
.licenses/npm/is-plain-object.dep.yml
generated
@@ -1,40 +0,0 @@
|
|||||||
---
|
|
||||||
name: is-plain-object
|
|
||||||
version: 5.0.0
|
|
||||||
type: npm
|
|
||||||
summary: Returns true if an object was created by the `Object` constructor, or Object.create(null).
|
|
||||||
homepage: https://github.com/jonschlinkert/is-plain-object
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE
|
|
||||||
text: |
|
|
||||||
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.
|
|
||||||
- sources: README.md
|
|
||||||
text: |-
|
|
||||||
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
|
||||||
Released under the [MIT License](LICENSE).
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 28, 2019._
|
|
||||||
notices: []
|
|
||||||
56
.licenses/npm/node-fetch.dep.yml
generated
56
.licenses/npm/node-fetch.dep.yml
generated
@@ -1,56 +0,0 @@
|
|||||||
---
|
|
||||||
name: node-fetch
|
|
||||||
version: 2.6.7
|
|
||||||
type: npm
|
|
||||||
summary: A light-weight module that brings window.fetch to node.js
|
|
||||||
homepage: https://github.com/bitinn/node-fetch
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE.md
|
|
||||||
text: |+
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 David Frank
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
- sources: README.md
|
|
||||||
text: |-
|
|
||||||
MIT
|
|
||||||
|
|
||||||
[npm-image]: https://flat.badgen.net/npm/v/node-fetch
|
|
||||||
[npm-url]: https://www.npmjs.com/package/node-fetch
|
|
||||||
[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch
|
|
||||||
[travis-url]: https://travis-ci.org/bitinn/node-fetch
|
|
||||||
[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master
|
|
||||||
[codecov-url]: https://codecov.io/gh/bitinn/node-fetch
|
|
||||||
[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch
|
|
||||||
[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch
|
|
||||||
[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square
|
|
||||||
[discord-url]: https://discord.gg/Zxbndcm
|
|
||||||
[opencollective-image]: https://opencollective.com/node-fetch/backers.svg
|
|
||||||
[opencollective-url]: https://opencollective.com/node-fetch
|
|
||||||
[whatwg-fetch]: https://fetch.spec.whatwg.org/
|
|
||||||
[response-init]: https://fetch.spec.whatwg.org/#responseinit
|
|
||||||
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams
|
|
||||||
[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers
|
|
||||||
[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md
|
|
||||||
[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md
|
|
||||||
[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md
|
|
||||||
notices: []
|
|
||||||
4
.licenses/npm/semver.dep.yml
generated
4
.licenses/npm/semver.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: semver
|
name: semver
|
||||||
version: 7.3.5
|
version: 7.5.4
|
||||||
type: npm
|
type: npm
|
||||||
summary: The semantic version parser used by npm.
|
summary: The semantic version parser used by npm.
|
||||||
homepage: https://github.com/npm/node-semver#readme
|
homepage:
|
||||||
license: isc
|
license: isc
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
---
|
---
|
||||||
name: tr46
|
name: undici
|
||||||
version: 0.0.3
|
version: 5.28.4
|
||||||
type: npm
|
type: npm
|
||||||
summary: An implementation of the Unicode TR46 spec
|
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||||
homepage: https://github.com/Sebmaster/tr46.js#readme
|
homepage: https://undici.nodejs.org
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: Auto-generated MIT license text
|
- sources: LICENSE
|
||||||
text: |
|
text: |
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Matteo Collina and Undici contributors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
@@ -27,4 +29,6 @@ licenses:
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
- sources: README.md
|
||||||
|
text: MIT
|
||||||
notices: []
|
notices: []
|
||||||
4
.licenses/npm/universal-user-agent.dep.yml
generated
4
.licenses/npm/universal-user-agent.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: universal-user-agent
|
name: universal-user-agent
|
||||||
version: 6.0.0
|
version: 6.0.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Get a user agent string in both browser and node
|
summary: Get a user agent string in both browser and node
|
||||||
homepage: https://github.com/gr2m/universal-user-agent#readme
|
homepage:
|
||||||
license: isc
|
license: isc
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.md
|
- sources: LICENSE.md
|
||||||
|
|||||||
23
.licenses/npm/webidl-conversions.dep.yml
generated
23
.licenses/npm/webidl-conversions.dep.yml
generated
@@ -1,23 +0,0 @@
|
|||||||
---
|
|
||||||
name: webidl-conversions
|
|
||||||
version: 3.0.1
|
|
||||||
type: npm
|
|
||||||
summary: Implements the WebIDL algorithms for converting to and from JavaScript values
|
|
||||||
homepage:
|
|
||||||
license: bsd-2-clause
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE.md
|
|
||||||
text: |
|
|
||||||
# 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.
|
|
||||||
notices: []
|
|
||||||
7
.prettierignore
Normal file
7
.prettierignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Ignore list
|
||||||
|
/*
|
||||||
|
|
||||||
|
# Do not ignore these folders:
|
||||||
|
!__tests__/
|
||||||
|
!.github/
|
||||||
|
!src/
|
||||||
11
.prettierrc.js
Normal file
11
.prettierrc.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
||||||
|
module.exports = {
|
||||||
|
printWidth: 80,
|
||||||
|
tabWidth: 2,
|
||||||
|
useTabs: false,
|
||||||
|
semi: true,
|
||||||
|
singleQuote: true,
|
||||||
|
trailingComma: 'none',
|
||||||
|
bracketSpacing: false,
|
||||||
|
arrowParens: 'avoid'
|
||||||
|
};
|
||||||
11
README.md
11
README.md
@@ -1,5 +1,7 @@
|
|||||||
# publish-action
|
# publish-action
|
||||||
|
|
||||||
|
[](https://github.com/actions/publish-action/actions/workflows/basic-validation.yml)
|
||||||
|
|
||||||
**Please note: this action is for internal usage only, issues are disabled and contributing PRs will not be reviewed. We also do not recommend this action for public or production usage while it is still in development.**
|
**Please note: this action is for internal usage only, issues are disabled and contributing PRs will not be reviewed. We also do not recommend this action for public or production usage while it is still in development.**
|
||||||
|
|
||||||
This action adds reliability to the new action versions publishing and handles the following cases:
|
This action adds reliability to the new action versions publishing and handles the following cases:
|
||||||
@@ -18,6 +20,15 @@ Read more about action versioning notation in [action-versioning.md](https://git
|
|||||||
|
|
||||||
To roll back a release in case of customer impact, start the workflow manually and specify the previous stable tag.
|
To roll back a release in case of customer impact, start the workflow manually and specify the previous stable tag.
|
||||||
|
|
||||||
|
## Recommended permissions
|
||||||
|
|
||||||
|
When using the `publish-action` in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
permissions:
|
||||||
|
contents: write # access to publish release
|
||||||
|
```
|
||||||
|
|
||||||
## Conributions
|
## Conributions
|
||||||
|
|
||||||
We don't accept contributions until the action is ready for production.
|
We don't accept contributions until the action is ready for production.
|
||||||
|
|||||||
@@ -1,39 +1,43 @@
|
|||||||
import * as github from "@actions/github";
|
import * as github from '@actions/github';
|
||||||
import * as apiUtils from "../src/api-utils";
|
import * as apiUtils from '../src/api-utils';
|
||||||
|
|
||||||
const prereleaseData = require("./data/pre-release.json");
|
import prereleaseData from './data/pre-release.json';
|
||||||
const releaseData = require("./data/release.json");
|
import releaseData from './data/release.json';
|
||||||
|
|
||||||
const token = "faketoken";
|
const token = 'faketoken';
|
||||||
const octokitClient = github.getOctokit(token);
|
const octokitClient = github.getOctokit(token);
|
||||||
|
|
||||||
let getReleaseSpy: jest.SpyInstance;
|
let getReleaseSpy: jest.SpyInstance;
|
||||||
|
|
||||||
process.env.GITHUB_REPOSITORY = "test/repository";
|
process.env.GITHUB_REPOSITORY = 'test/repository';
|
||||||
|
|
||||||
describe("validateIfReleaseIsPublished", () => {
|
describe('validateIfReleaseIsPublished', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
getReleaseSpy = jest.spyOn(octokitClient.repos, "getReleaseByTag");
|
getReleaseSpy = jest.spyOn(octokitClient.rest.repos, 'getReleaseByTag');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("throw if release is marked as pre-release", async () => {
|
it('throw if release is marked as pre-release', async () => {
|
||||||
getReleaseSpy.mockReturnValue(prereleaseData);
|
getReleaseSpy.mockReturnValue(prereleaseData);
|
||||||
|
|
||||||
expect.assertions(1);
|
expect.assertions(1);
|
||||||
await expect(apiUtils.validateIfReleaseIsPublished("v1.0.0", octokitClient)).rejects.toThrowError(
|
await expect(
|
||||||
"The 'v1.0.0' release is marked as pre-release. Updating tags for pre-release is not supported"
|
apiUtils.validateIfReleaseIsPublished('v1.0.0', octokitClient)
|
||||||
);
|
).rejects.toThrow(
|
||||||
});
|
"The 'v1.0.0' release is marked as pre-release. Updating tags for pre-release is not supported"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("validate that release is published", async () => {
|
it('validate that release is published', async () => {
|
||||||
getReleaseSpy.mockReturnValue(releaseData);
|
getReleaseSpy.mockReturnValue(releaseData);
|
||||||
|
|
||||||
expect.assertions(1);
|
expect.assertions(1);
|
||||||
await expect(apiUtils.validateIfReleaseIsPublished("v1.1.0", octokitClient)).resolves.not.toThrow();
|
await expect(
|
||||||
});
|
apiUtils.validateIfReleaseIsPublished('v1.1.0', octokitClient)
|
||||||
|
).resolves.not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1,69 +1,93 @@
|
|||||||
import * as versionUtils from "../src/version-utils";
|
import * as versionUtils from '../src/version-utils';
|
||||||
|
import stableSemver from './data/stable-semver.json';
|
||||||
|
import stableBuildSemver from './data/stable-build-semver.json';
|
||||||
|
import prereleaseSemver from './data/prerelease-semver.json';
|
||||||
|
import prereleaseBuildSemver from './data/prerelease-build-semver.json';
|
||||||
|
|
||||||
describe("isStableSemverVersion", () => {
|
describe('isStableSemverVersion', () => {
|
||||||
it("validate if a version is stable", () => {
|
it('validate if a version is stable', () => {
|
||||||
const semverVersion = require("./data/stable-semver.json");
|
expect(
|
||||||
expect(versionUtils.isStableSemverVersion(semverVersion)).toBeTruthy();
|
versionUtils.isStableSemverVersion(stableSemver as any)
|
||||||
});
|
).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
it("validate if a version with build metadata is stable", () => {
|
it('validate if a version with build metadata is stable', () => {
|
||||||
const semverVersion = require("./data/stable-build-semver.json");
|
expect(
|
||||||
expect(versionUtils.isStableSemverVersion(semverVersion)).toBeTruthy();
|
versionUtils.isStableSemverVersion(stableBuildSemver as any)
|
||||||
});
|
).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
it("validate if a pre-release version is not stable", () => {
|
it('validate if a pre-release version is not stable', () => {
|
||||||
const semverVersion = require("./data/prerelease-semver.json");
|
expect(
|
||||||
expect(versionUtils.isStableSemverVersion(semverVersion)).toBeFalsy();
|
versionUtils.isStableSemverVersion(prereleaseSemver as any)
|
||||||
});
|
).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
it("validate if a pre-release version with build metadata is not stable", () => {
|
it('validate if a pre-release version with build metadata is not stable', () => {
|
||||||
const semverVersion = require("./data/prerelease-build-semver.json");
|
expect(
|
||||||
expect(versionUtils.isStableSemverVersion(semverVersion)).toBeFalsy();
|
versionUtils.isStableSemverVersion(prereleaseBuildSemver as any)
|
||||||
});
|
).toBeFalsy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("validateSemverVersionFromTag", () => {
|
describe('validateSemverVersionFromTag', () => {
|
||||||
it("validate a tag containing an valid semantic version", () => {
|
it('validate a tag containing a valid semantic version', () => {
|
||||||
expect(() => versionUtils.validateSemverVersionFromTag("1.0.0")).not.toThrow();
|
expect(() =>
|
||||||
});
|
versionUtils.validateSemverVersionFromTag('1.0.0')
|
||||||
|
).not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
it("validate a tag containing an valid semantic version with 'v' prefix", () => {
|
it("validate a tag containing a valid semantic version with 'v' prefix", () => {
|
||||||
expect(() => versionUtils.validateSemverVersionFromTag("v1.0.0")).not.toThrow();
|
expect(() =>
|
||||||
});
|
versionUtils.validateSemverVersionFromTag('v1.0.0')
|
||||||
|
).not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
it("validate a tag containing an valid semantic version with build metadata", () => {
|
it('validate a tag containing a valid semantic version with build metadata', () => {
|
||||||
expect(() => versionUtils.validateSemverVersionFromTag("v1.0.0+20130313144700")).not.toThrow();
|
expect(() =>
|
||||||
});
|
versionUtils.validateSemverVersionFromTag('v1.0.0+20130313144700')
|
||||||
|
).not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
it("throw when a tag contains an invalid semantic version", () => {
|
it('throw when a tag contains an invalid semantic version', () => {
|
||||||
expect(() => versionUtils.validateSemverVersionFromTag("1.0.0invalid")).toThrowError(
|
expect(() =>
|
||||||
"The '1.0.0invalid' doesn't satisfy semantic versioning specification"
|
versionUtils.validateSemverVersionFromTag('1.0.0invalid')
|
||||||
);
|
).toThrow(
|
||||||
});
|
"The '1.0.0invalid' doesn't satisfy semantic versioning specification"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("throw when a tag contains an valid unstable semantic version", () => {
|
it('throw when a tag contains a valid unstable semantic version', () => {
|
||||||
expect(() => versionUtils.validateSemverVersionFromTag("v1.0.0-beta.1")).toThrowError(
|
expect(() =>
|
||||||
"It is not allowed to specify pre-release version to update the major tag"
|
versionUtils.validateSemverVersionFromTag('v1.0.0-beta.1')
|
||||||
);
|
).toThrow(
|
||||||
});
|
'It is not allowed to specify pre-release version to update the major tag'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("throw when a tag contains an valid unstable semantic version with build metadata", () => {
|
it('throw when a tag contains a valid unstable semantic version with build metadata', () => {
|
||||||
expect(() => versionUtils.validateSemverVersionFromTag("v1.0.0-beta.1+20130313144700")).toThrowError(
|
expect(() =>
|
||||||
"It is not allowed to specify pre-release version to update the major tag"
|
versionUtils.validateSemverVersionFromTag('v1.0.0-beta.1+20130313144700')
|
||||||
);
|
).toThrow(
|
||||||
});
|
'It is not allowed to specify pre-release version to update the major tag'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getMajorTagFromFullTag", () => {
|
describe('getMajorTagFromFullTag', () => {
|
||||||
describe("get a valid major tag from full tag", () => {
|
describe('get a valid major tag from full tag', () => {
|
||||||
it.each([
|
it.each([
|
||||||
["1.0.0", "1"],
|
['1.0.0', '1'],
|
||||||
["v1.0.0", "v1"],
|
['v1.0.0', 'v1'],
|
||||||
["v1.0.0-beta.1", "v1"],
|
['v1.0.0-beta.1', 'v1'],
|
||||||
["v1.0.0+20130313144700", "v1"],
|
['v1.0.0+20130313144700', 'v1']
|
||||||
] as [string, string][])("%s -> %s", (sourceTag: string, expectedMajorTag: string) => {
|
] as [string, string][])(
|
||||||
const resultantMajorTag = versionUtils.getMajorTagFromFullTag(sourceTag);
|
'%s -> %s',
|
||||||
expect(resultantMajorTag).toBe(expectedMajorTag);
|
(sourceTag: string, expectedMajorTag: string) => {
|
||||||
});
|
const resultantMajorTag =
|
||||||
});
|
versionUtils.getMajorTagFromFullTag(sourceTag);
|
||||||
|
expect(resultantMajorTag).toBe(expectedMajorTag);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -13,5 +13,5 @@ outputs:
|
|||||||
major-tag:
|
major-tag:
|
||||||
description: 'The major version tag that has been updated (created). Examples: v1, 1'
|
description: 'The major version tag that has been updated (created). Examples: v1, 1'
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
33531
dist/index.js
vendored
33531
dist/index.js
vendored
File diff suppressed because one or more lines are too long
11249
package-lock.json
generated
11249
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
33
package.json
33
package.json
@@ -1,13 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "publish-action",
|
"name": "publish-action",
|
||||||
"version": "0.2.1",
|
"version": "0.3.0",
|
||||||
"description": "Update the major version tag (v1, v2, etc.) to point to the specified tag",
|
"description": "Update the major version tag (v1, v2, etc.) to point to the specified tag",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc && ncc build",
|
"build": "tsc && ncc build",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"format-check": "echo \"Fake command that does nothing. It is used in reusable workflows\"",
|
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
|
||||||
"lint": "echo \"Fake command that does nothing. It is used in reusable workflows\""
|
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"",
|
||||||
|
"lint": "eslint --config ./.eslintrc.js \"**/*.ts\"",
|
||||||
|
"lint:fix": "eslint --config ./.eslintrc.js \"**/*.ts\" --fix"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -25,17 +27,24 @@
|
|||||||
"homepage": "https://github.com/actions/publish-action#readme",
|
"homepage": "https://github.com/actions/publish-action#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.7",
|
"@actions/core": "^1.2.7",
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/github": "^6.0.0",
|
||||||
"@actions/github": "^4.0.0",
|
"@actions/http-client": "^2.2.0",
|
||||||
"semver": "^7.3.5"
|
"semver": "^7.5.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^29.5.10",
|
||||||
"@types/semver": "^7.3.6",
|
"@types/semver": "^7.3.6",
|
||||||
"@vercel/ncc": "^0.28.5",
|
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
||||||
"jest": "^27.2.5",
|
"@typescript-eslint/parser": "^6.12.0",
|
||||||
"jest-circus": "^27.2.5",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"ts-jest": "^27.0.5",
|
"eslint": "^8.35.0",
|
||||||
"typescript": "^4.2.4"
|
"eslint-config-prettier": "^9.0.0",
|
||||||
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"jest-circus": "^29.7.0",
|
||||||
|
"prettier": "^3.1.0",
|
||||||
|
"ts-jest": "^29.1.1",
|
||||||
|
"typescript": "^5.3.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
173
src/api-utils.ts
173
src/api-utils.ts
@@ -1,114 +1,121 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { context } from '@actions/github';
|
import {context} from '@actions/github';
|
||||||
import { GitHub } from '@actions/github/lib/utils';
|
import {GitHub} from '@actions/github/lib/utils';
|
||||||
import { HttpClient } from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
|
|
||||||
interface GitRef {
|
interface GitRef {
|
||||||
ref: string;
|
ref: string;
|
||||||
node_id: string;
|
node_id: string;
|
||||||
|
url: string;
|
||||||
|
object: {
|
||||||
|
type: string;
|
||||||
|
sha: string;
|
||||||
url: string;
|
url: string;
|
||||||
object: {
|
};
|
||||||
type: string;
|
}
|
||||||
sha: string;
|
|
||||||
url: string;
|
interface ErrorStatus extends Error {
|
||||||
};
|
status?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findTag(
|
async function findTag(
|
||||||
tag: string,
|
tag: string,
|
||||||
octokitClient: InstanceType<typeof GitHub>
|
octokitClient: InstanceType<typeof GitHub>
|
||||||
): Promise<GitRef | null> {
|
): Promise<GitRef | null> {
|
||||||
try {
|
try {
|
||||||
const { data: foundTag } = await octokitClient.git.getRef({
|
const {data: foundTag} = await octokitClient.rest.git.getRef({
|
||||||
...context.repo,
|
...context.repo,
|
||||||
ref: `tags/${tag}`
|
ref: `tags/${tag}`
|
||||||
});
|
});
|
||||||
|
|
||||||
return foundTag;
|
return foundTag;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.status === 404) {
|
if ((err as ErrorStatus).status === 404) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Retrieving refs failed with the following error: ${err}`
|
`Retrieving refs failed with the following error: ${err}`
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTagSHA(
|
async function getTagSHA(
|
||||||
tag: string,
|
tag: string,
|
||||||
octokitClient: InstanceType<typeof GitHub>
|
octokitClient: InstanceType<typeof GitHub>
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const foundTag = await findTag(tag, octokitClient);
|
const foundTag = await findTag(tag, octokitClient);
|
||||||
if (!foundTag) {
|
if (!foundTag) {
|
||||||
throw new Error(
|
throw new Error(`The '${tag}' tag does not exist in the remote repository`);
|
||||||
`The '${tag}' tag does not exist in the remote repository`
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return foundTag.object.sha;
|
return foundTag.object.sha;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function validateIfReleaseIsPublished(
|
export async function validateIfReleaseIsPublished(
|
||||||
tag: string,
|
tag: string,
|
||||||
octokitClient: InstanceType<typeof GitHub>
|
octokitClient: InstanceType<typeof GitHub>
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const { data: foundRelease } = await octokitClient.repos.getReleaseByTag({
|
const {data: foundRelease} = await octokitClient.rest.repos.getReleaseByTag(
|
||||||
...context.repo,
|
{
|
||||||
tag,
|
...context.repo,
|
||||||
});
|
tag
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (foundRelease.prerelease) {
|
if (foundRelease.prerelease) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The '${foundRelease.name}' release is marked as pre-release. Updating tags for pre-release is not supported`
|
`The '${foundRelease.name}' release is marked as pre-release. Updating tags for pre-release is not supported`
|
||||||
);
|
);
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
if (err.status === 404) {
|
|
||||||
throw new Error(
|
|
||||||
`No GitHub release found for the ${tag} tag`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
throw new Error(
|
|
||||||
`Retrieving releases failed with the following error: ${err}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if ((err as ErrorStatus).status === 404) {
|
||||||
|
throw new Error(`No GitHub release found for the ${tag} tag`);
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
`Retrieving releases failed with the following error: ${err}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateTag(
|
export async function updateTag(
|
||||||
sourceTag: string,
|
sourceTag: string,
|
||||||
targetTag: string,
|
targetTag: string,
|
||||||
octokitClient: InstanceType<typeof GitHub>
|
octokitClient: InstanceType<typeof GitHub>
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const sourceTagSHA = await getTagSHA(sourceTag, octokitClient);
|
const sourceTagSHA = await getTagSHA(sourceTag, octokitClient);
|
||||||
const foundTargetTag = await findTag(targetTag, octokitClient);
|
const foundTargetTag = await findTag(targetTag, octokitClient);
|
||||||
const refName = `tags/${targetTag}`;
|
const refName = `tags/${targetTag}`;
|
||||||
|
|
||||||
if (foundTargetTag) {
|
if (foundTargetTag) {
|
||||||
core.info(`Updating the '${targetTag}' tag to point to the '${sourceTag}' tag`);
|
core.info(
|
||||||
|
`Updating the '${targetTag}' tag to point to the '${sourceTag}' tag`
|
||||||
|
);
|
||||||
|
|
||||||
await octokitClient.git.updateRef({
|
await octokitClient.rest.git.updateRef({
|
||||||
...context.repo,
|
...context.repo,
|
||||||
ref: refName,
|
ref: refName,
|
||||||
sha: sourceTagSHA,
|
sha: sourceTagSHA,
|
||||||
force: true
|
force: true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
core.info(`Creating the '${targetTag}' tag from the '${sourceTag}' tag`);
|
core.info(`Creating the '${targetTag}' tag from the '${sourceTag}' tag`);
|
||||||
|
|
||||||
await octokitClient.git.createRef({
|
await octokitClient.rest.git.createRef({
|
||||||
...context.repo,
|
...context.repo,
|
||||||
ref: `refs/${refName}`,
|
ref: `refs/${refName}`,
|
||||||
sha: sourceTagSHA
|
sha: sourceTagSHA
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function postMessageToSlack(slackWebhook: string, message: string): Promise<void> {
|
export async function postMessageToSlack(
|
||||||
const jsonData = {text: message}
|
slackWebhook: string,
|
||||||
const http = new HttpClient();
|
message: string
|
||||||
await http.postJson(slackWebhook, jsonData);
|
): Promise<void> {
|
||||||
|
const jsonData = {text: message};
|
||||||
|
const http = new HttpClient();
|
||||||
|
await http.postJson(slackWebhook, jsonData);
|
||||||
}
|
}
|
||||||
59
src/main.ts
59
src/main.ts
@@ -1,40 +1,49 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
import { context } from '@actions/github';
|
import {context} from '@actions/github';
|
||||||
import { updateTag, validateIfReleaseIsPublished, postMessageToSlack } from './api-utils';
|
import {
|
||||||
import { validateSemverVersionFromTag, getMajorTagFromFullTag } from './version-utils';
|
updateTag,
|
||||||
|
validateIfReleaseIsPublished,
|
||||||
|
postMessageToSlack
|
||||||
|
} from './api-utils';
|
||||||
|
import {
|
||||||
|
validateSemverVersionFromTag,
|
||||||
|
getMajorTagFromFullTag
|
||||||
|
} from './version-utils';
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const token = core.getInput('token');
|
const token = core.getInput('token');
|
||||||
const octokitClient = github.getOctokit(token);
|
const octokitClient = github.getOctokit(token);
|
||||||
const sourceTagName = core.getInput('source-tag');
|
const sourceTagName = core.getInput('source-tag');
|
||||||
|
|
||||||
validateSemverVersionFromTag(sourceTagName);
|
validateSemverVersionFromTag(sourceTagName);
|
||||||
|
|
||||||
await validateIfReleaseIsPublished(sourceTagName, octokitClient);
|
await validateIfReleaseIsPublished(sourceTagName, octokitClient);
|
||||||
|
|
||||||
const majorTag = getMajorTagFromFullTag(sourceTagName);
|
const majorTag = getMajorTagFromFullTag(sourceTagName);
|
||||||
await updateTag(sourceTagName, majorTag, octokitClient);
|
await updateTag(sourceTagName, majorTag, octokitClient);
|
||||||
|
|
||||||
core.setOutput('major-tag', majorTag);
|
core.setOutput('major-tag', majorTag);
|
||||||
core.info(`The '${majorTag}' major tag now points to the '${sourceTagName}' tag`);
|
core.info(
|
||||||
|
`The '${majorTag}' major tag now points to the '${sourceTagName}' tag`
|
||||||
|
);
|
||||||
|
|
||||||
const slackMessage = `The ${majorTag} tag has been successfully updated for the ${context.repo.repo} action to include changes from ${sourceTagName}`;
|
const slackMessage = `The ${majorTag} tag has been successfully updated for the ${context.repo.repo} action to include changes from ${sourceTagName}`;
|
||||||
await reportStatusToSlack(slackMessage);
|
await reportStatusToSlack(slackMessage);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed((error as Error).message);
|
core.setFailed((error as Error).message);
|
||||||
|
|
||||||
const slackMessage = `Failed to update a major tag for the ${context.repo.repo} action`;
|
const slackMessage = `Failed to update a major tag for the ${context.repo.repo} action`;
|
||||||
await reportStatusToSlack(slackMessage);
|
await reportStatusToSlack(slackMessage);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
async function reportStatusToSlack(message: string): Promise<void> {
|
async function reportStatusToSlack(message: string): Promise<void> {
|
||||||
const slackWebhook = core.getInput('slack-webhook');
|
const slackWebhook = core.getInput('slack-webhook');
|
||||||
if (slackWebhook) {
|
if (slackWebhook) {
|
||||||
await postMessageToSlack(slackWebhook, message);
|
await postMessageToSlack(slackWebhook, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
run();
|
||||||
@@ -2,24 +2,24 @@ import semverParse from 'semver/functions/parse';
|
|||||||
import SemVer from 'semver/classes/semver';
|
import SemVer from 'semver/classes/semver';
|
||||||
|
|
||||||
export function isStableSemverVersion(version: SemVer): boolean {
|
export function isStableSemverVersion(version: SemVer): boolean {
|
||||||
return version.prerelease.length === 0
|
return version.prerelease.length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMajorTagFromFullTag(fullTag: string): string {
|
export function getMajorTagFromFullTag(fullTag: string): string {
|
||||||
return fullTag.split('.')[0];
|
return fullTag.split('.')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function validateSemverVersionFromTag(tag: string): void {
|
export function validateSemverVersionFromTag(tag: string): void {
|
||||||
const semverVersion = semverParse(tag);
|
const semverVersion = semverParse(tag);
|
||||||
if (!semverVersion) {
|
if (!semverVersion) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The '${tag}' doesn't satisfy semantic versioning specification`
|
`The '${tag}' doesn't satisfy semantic versioning specification`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isStableSemverVersion(semverVersion)) {
|
if (!isStableSemverVersion(semverVersion)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'It is not allowed to specify pre-release version to update the major tag'
|
'It is not allowed to specify pre-release version to update the major tag'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user