mirror of
https://github.com/actions/publish-action.git
synced 2025-02-24 08:12:33 +00:00
Node version upgrade to 20 (#38)
* Node version update to 20 * 1.0.0 * Run Format check * Formatted changes * Update package.json Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com> * Update api-utils.ts --------- Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
This commit is contained in:
parent
7ea110f150
commit
f784495ce7
2
.github/workflows/basic-validation.yml
vendored
2
.github/workflows/basic-validation.yml
vendored
@ -10,3 +10,5 @@ jobs:
|
||||
call-basic-validation:
|
||||
name: Basic validation
|
||||
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:
|
||||
name: Check dist/
|
||||
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
||||
with:
|
||||
node-version: '20'
|
||||
|
BIN
.licenses/npm/@actions/core.dep.yml
generated
BIN
.licenses/npm/@actions/core.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/github.dep.yml
generated
BIN
.licenses/npm/@actions/github.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/http-client-1.0.11.dep.yml
generated
BIN
.licenses/npm/@actions/http-client-1.0.11.dep.yml
generated
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@octokit/auth-token.dep.yml
generated
BIN
.licenses/npm/@octokit/auth-token.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/core.dep.yml
generated
BIN
.licenses/npm/@octokit/core.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/endpoint.dep.yml
generated
BIN
.licenses/npm/@octokit/endpoint.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/graphql.dep.yml
generated
BIN
.licenses/npm/@octokit/graphql.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/openapi-types.dep.yml
generated
BIN
.licenses/npm/@octokit/openapi-types.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/plugin-paginate-rest.dep.yml
generated
BIN
.licenses/npm/@octokit/plugin-paginate-rest.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@octokit/request-error.dep.yml
generated
BIN
.licenses/npm/@octokit/request-error.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/request.dep.yml
generated
BIN
.licenses/npm/@octokit/request.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/types.dep.yml
generated
BIN
.licenses/npm/@octokit/types.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/before-after-hook.dep.yml
generated
BIN
.licenses/npm/before-after-hook.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/is-plain-object.dep.yml
generated
BIN
.licenses/npm/is-plain-object.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/node-fetch.dep.yml
generated
BIN
.licenses/npm/node-fetch.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/universal-user-agent.dep.yml
generated
BIN
.licenses/npm/universal-user-agent.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/webidl-conversions.dep.yml
generated
BIN
.licenses/npm/webidl-conversions.dep.yml
generated
Binary file not shown.
@ -13,7 +13,7 @@ process.env.GITHUB_REPOSITORY = 'test/repository';
|
||||
|
||||
describe('validateIfReleaseIsPublished', () => {
|
||||
beforeEach(() => {
|
||||
getReleaseSpy = jest.spyOn(octokitClient.repos, 'getReleaseByTag');
|
||||
getReleaseSpy = jest.spyOn(octokitClient.rest.repos, 'getReleaseByTag');
|
||||
});
|
||||
|
||||
it('throw if release is marked as pre-release', async () => {
|
||||
|
@ -13,5 +13,5 @@ outputs:
|
||||
major-tag:
|
||||
description: 'The major version tag that has been updated (created). Examples: v1, 1'
|
||||
runs:
|
||||
using: 'node16'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
32684
dist/index.js
vendored
32684
dist/index.js
vendored
File diff suppressed because one or more lines are too long
8657
package-lock.json
generated
8657
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
@ -27,24 +27,24 @@
|
||||
"homepage": "https://github.com/actions/publish-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.7",
|
||||
"@actions/github": "^4.0.0",
|
||||
"@actions/http-client": "^1.0.11",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/http-client": "^2.2.0",
|
||||
"semver": "^7.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/jest": "^29.5.10",
|
||||
"@types/semver": "^7.3.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
||||
"@typescript-eslint/parser": "^5.54.0",
|
||||
"@vercel/ncc": "^0.28.5",
|
||||
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
||||
"@typescript-eslint/parser": "^6.12.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.35.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"jest": "^27.2.5",
|
||||
"jest-circus": "^27.2.5",
|
||||
"prettier": "^2.8.4",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^4.2.4"
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"prettier": "^3.1.0",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.3.2"
|
||||
}
|
||||
}
|
||||
|
@ -14,19 +14,23 @@ interface GitRef {
|
||||
};
|
||||
}
|
||||
|
||||
interface ErrorStatus extends Error {
|
||||
status?: number;
|
||||
}
|
||||
|
||||
async function findTag(
|
||||
tag: string,
|
||||
octokitClient: InstanceType<typeof GitHub>
|
||||
): Promise<GitRef | null> {
|
||||
try {
|
||||
const {data: foundTag} = await octokitClient.git.getRef({
|
||||
const {data: foundTag} = await octokitClient.rest.git.getRef({
|
||||
...context.repo,
|
||||
ref: `tags/${tag}`
|
||||
});
|
||||
|
||||
return foundTag;
|
||||
} catch (err) {
|
||||
if (err.status === 404) {
|
||||
if ((err as ErrorStatus).status === 404) {
|
||||
return null;
|
||||
} else {
|
||||
throw new Error(
|
||||
@ -53,10 +57,12 @@ export async function validateIfReleaseIsPublished(
|
||||
octokitClient: InstanceType<typeof GitHub>
|
||||
): Promise<void> {
|
||||
try {
|
||||
const {data: foundRelease} = await octokitClient.repos.getReleaseByTag({
|
||||
...context.repo,
|
||||
tag
|
||||
});
|
||||
const {data: foundRelease} = await octokitClient.rest.repos.getReleaseByTag(
|
||||
{
|
||||
...context.repo,
|
||||
tag
|
||||
}
|
||||
);
|
||||
|
||||
if (foundRelease.prerelease) {
|
||||
throw new Error(
|
||||
@ -64,7 +70,7 @@ export async function validateIfReleaseIsPublished(
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.status === 404) {
|
||||
if ((err as ErrorStatus).status === 404) {
|
||||
throw new Error(`No GitHub release found for the ${tag} tag`);
|
||||
} else {
|
||||
throw new Error(
|
||||
@ -88,7 +94,7 @@ export async function updateTag(
|
||||
`Updating the '${targetTag}' tag to point to the '${sourceTag}' tag`
|
||||
);
|
||||
|
||||
await octokitClient.git.updateRef({
|
||||
await octokitClient.rest.git.updateRef({
|
||||
...context.repo,
|
||||
ref: refName,
|
||||
sha: sourceTagSHA,
|
||||
@ -97,7 +103,7 @@ export async function updateTag(
|
||||
} else {
|
||||
core.info(`Creating the '${targetTag}' tag from the '${sourceTag}' tag`);
|
||||
|
||||
await octokitClient.git.createRef({
|
||||
await octokitClient.rest.git.createRef({
|
||||
...context.repo,
|
||||
ref: `refs/${refName}`,
|
||||
sha: sourceTagSHA
|
||||
|
Loading…
Reference in New Issue
Block a user