mirror of
https://github.com/yanhao98/semantic-release-action.git
synced 2025-07-12 23:30:48 +08:00
feat: A
This commit is contained in:
7
.github/workflows/ci.yaml
vendored
7
.github/workflows/ci.yaml
vendored
@ -19,4 +19,9 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: yanhao98/semantic-release-example@main
|
||||
- uses: yanhao98/semantic-release-example@main
|
||||
id: release
|
||||
- name: Print the new release version
|
||||
run: |
|
||||
echo ${{ steps.release.outputs.next_release_published }}
|
||||
echo ${{ steps.release.outputs.next_release_version }}
|
@ -4,6 +4,9 @@ author: 'Your name or organization here'
|
||||
branding:
|
||||
icon: 'heart'
|
||||
color: 'red'
|
||||
outputs:
|
||||
next_release_version:
|
||||
description: 'Version of the new release'
|
||||
runs:
|
||||
# pre: 'index.mjs'
|
||||
using: 'node20'
|
||||
|
20
index.mjs
20
index.mjs
@ -2,14 +2,18 @@ import { exec as execCallback } from 'node:child_process';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { promisify } from 'node:util';
|
||||
import core from '@actions/core';
|
||||
const exec = promisify(execCallback);
|
||||
const self_cwd = dirname(fileURLToPath(import.meta.url));
|
||||
import packageJson from './package.json' with { type: "json" };
|
||||
// import packageJson from './package.json' with { type: "json" };
|
||||
|
||||
// https://github.dev/cycjimmy/semantic-release-action
|
||||
async function installDependencies() {
|
||||
// const _extras = extras.replace(/['"]/g, '').replace(/[\n\r]/g, ' ');
|
||||
const deps = ['semantic-release'].join(' ');
|
||||
const deps = [
|
||||
'semantic-release',
|
||||
'@actions/core',
|
||||
].join(' ');
|
||||
const { stdout, stderr } = await exec(`npm install ${deps} --no-audit --no-save`, {
|
||||
cwd: self_cwd
|
||||
});
|
||||
@ -20,13 +24,21 @@ async function runRelease() {
|
||||
const semanticRelease = await import('semantic-release');
|
||||
const result = await semanticRelease.default(
|
||||
{
|
||||
plugins: packageJson.release.plugins,
|
||||
// plugins: packageJson.release.plugins,
|
||||
dryRun: process.env.CI ? false : true,
|
||||
},
|
||||
{
|
||||
// cwd: ''
|
||||
}
|
||||
);
|
||||
// console.debug(`nextRelease.version :>> `, nextRelease.version);
|
||||
// if (process.env.GITHUB_OUTPUT) fs.writeFileSync(process.env.GITHUB_OUTPUT, `NEXT_RELEASE_VERSION=${nextRelease.version}`);
|
||||
return result;
|
||||
if (result) {
|
||||
core.setOutput('next_release_published', 'true');
|
||||
core.setOutput('next_release_version', result.nextRelease.version);
|
||||
} else {
|
||||
core.setOutput('next_release_published', 'false');
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.CI) await installDependencies();
|
||||
|
@ -0,0 +1,49 @@
|
||||
2024-10-06T14:35:04.1779664Z ##[group]Run yanhao98/semantic-release-example@main
|
||||
2024-10-06T14:35:04.1780519Z env:
|
||||
2024-10-06T14:35:04.1780894Z TZ: Asia/Shanghai
|
||||
2024-10-06T14:35:04.1781309Z ##[endgroup]
|
||||
2024-10-06T14:35:04.2106109Z (node:1761) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
||||
2024-10-06T14:35:04.2109835Z (Use `node --trace-warnings ...` to show where the warning was created)
|
||||
2024-10-06T14:35:17.7126122Z
|
||||
2024-10-06T14:35:17.7128039Z added 324 packages in 13s
|
||||
2024-10-06T14:35:17.7128671Z
|
||||
2024-10-06T14:35:17.7129167Z 100 packages are looking for funding
|
||||
2024-10-06T14:35:17.7130191Z run `npm fund` for details
|
||||
2024-10-06T14:35:17.7131142Z
|
||||
2024-10-06T14:35:18.1847578Z [10:35:18 PM] [semantic-release] › ℹ Running semantic-release version 24.1.2
|
||||
2024-10-06T14:35:18.2815028Z [10:35:18 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
|
||||
2024-10-06T14:35:18.2817079Z [10:35:18 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/git"
|
||||
2024-10-06T14:35:18.2821252Z [10:35:18 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
|
||||
2024-10-06T14:35:18.2825243Z [10:35:18 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
|
||||
2024-10-06T14:35:18.2829021Z [10:35:18 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/changelog"
|
||||
2024-10-06T14:35:18.2831145Z [10:35:18 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/git"
|
||||
2024-10-06T14:35:19.0915008Z [10:35:19 PM] [semantic-release] › ✔ Run automated release from branch main on repository https://github.com/yanhao98/semantic-release-example
|
||||
2024-10-06T14:35:19.2549954Z [10:35:19 PM] [semantic-release] › ✔ Allowed to push to the Git repository
|
||||
2024-10-06T14:35:19.2554522Z [10:35:19 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/changelog"
|
||||
2024-10-06T14:35:19.2565979Z [10:35:19 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/changelog"
|
||||
2024-10-06T14:35:19.2568137Z [10:35:19 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/git"
|
||||
2024-10-06T14:35:19.2575223Z [10:35:19 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/git"
|
||||
2024-10-06T14:35:19.2577671Z [10:35:19 PM] [semantic-release] › ℹ No git tag version found on branch main
|
||||
2024-10-06T14:35:19.2580146Z [10:35:19 PM] [semantic-release] › ℹ No previous release found, retrieving all commits
|
||||
2024-10-06T14:35:19.2663792Z [10:35:19 PM] [semantic-release] › ℹ Found 2 commits since last release
|
||||
2024-10-06T14:35:19.2667850Z [10:35:19 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
|
||||
2024-10-06T14:35:19.2709264Z [10:35:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: feat: first commit
|
||||
2024-10-06T14:35:19.2716462Z [10:35:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ The release type for the commit is minor
|
||||
2024-10-06T14:35:19.2718830Z [10:35:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: initial commit
|
||||
2024-10-06T14:35:19.2721212Z [10:35:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ The commit should not trigger a release
|
||||
2024-10-06T14:35:19.2723581Z [10:35:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analysis of 2 commits complete: minor release
|
||||
2024-10-06T14:35:19.2725655Z [10:35:19 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
|
||||
2024-10-06T14:35:19.2763390Z [10:35:19 PM] [semantic-release] › ℹ There is no previous release, the next release version is 1.0.0
|
||||
2024-10-06T14:35:19.2784248Z [10:35:19 PM] [semantic-release] › ℹ Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
|
||||
2024-10-06T14:35:19.3201938Z [10:35:19 PM] [semantic-release] › ✔ Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
|
||||
2024-10-06T14:35:19.3204796Z [10:35:19 PM] [semantic-release] › ℹ Start step "prepare" of plugin "@semantic-release/changelog"
|
||||
2024-10-06T14:35:19.3241468Z [10:35:19 PM] [semantic-release] [@semantic-release/changelog] › ℹ Create /home/runner/work/semantic-release-example/semantic-release-example/CHANGELOG.md
|
||||
2024-10-06T14:35:19.3247876Z [10:35:19 PM] [semantic-release] › ✔ Completed step "prepare" of plugin "@semantic-release/changelog"
|
||||
2024-10-06T14:35:19.3302306Z [10:35:19 PM] [semantic-release] › ℹ Start step "prepare" of plugin "@semantic-release/git"
|
||||
2024-10-06T14:35:19.3374887Z [10:35:19 PM] [semantic-release] [@semantic-release/git] › ℹ Found 1 file(s) to commit
|
||||
2024-10-06T14:35:19.8223732Z [10:35:19 PM] [semantic-release] [@semantic-release/git] › ℹ Prepared Git release: v1.0.0
|
||||
2024-10-06T14:35:19.8224835Z [10:35:19 PM] [semantic-release] › ✔ Completed step "prepare" of plugin "@semantic-release/git"
|
||||
2024-10-06T14:35:19.8265406Z [10:35:19 PM] [semantic-release] › ℹ Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
|
||||
2024-10-06T14:35:19.8404194Z [10:35:19 PM] [semantic-release] › ✔ Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
|
||||
2024-10-06T14:35:21.2218523Z [10:35:21 PM] [semantic-release] › ✔ Created tag v1.0.0
|
||||
2024-10-06T14:35:21.2227774Z [10:35:21 PM] [semantic-release] › ✔ Published release 1.0.0 on default channel
|
@ -3,6 +3,9 @@
|
||||
"packageManager": "pnpm@9.11.0",
|
||||
"name": "@murielmay67-1/semantic-release-example",
|
||||
"files": [],
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.11.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
@ -28,4 +31,4 @@
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
52
pnpm-lock.yaml
generated
52
pnpm-lock.yaml
generated
@ -7,6 +7,10 @@ settings:
|
||||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@actions/core':
|
||||
specifier: ^1.11.1
|
||||
version: 1.11.1
|
||||
devDependencies:
|
||||
'@semantic-release/changelog':
|
||||
specifier: ^6.0.3
|
||||
@ -23,6 +27,18 @@ importers:
|
||||
|
||||
packages:
|
||||
|
||||
'@actions/core@1.11.1':
|
||||
resolution: {integrity: sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==}
|
||||
|
||||
'@actions/exec@1.1.1':
|
||||
resolution: {integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==}
|
||||
|
||||
'@actions/http-client@2.2.3':
|
||||
resolution: {integrity: sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==}
|
||||
|
||||
'@actions/io@1.1.3':
|
||||
resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==}
|
||||
|
||||
'@babel/code-frame@7.25.7':
|
||||
resolution: {integrity: sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
@ -39,6 +55,10 @@ packages:
|
||||
resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
|
||||
engines: {node: '>=0.1.90'}
|
||||
|
||||
'@fastify/busboy@2.1.1':
|
||||
resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||
engines: {node: '>= 8'}
|
||||
@ -1140,6 +1160,10 @@ packages:
|
||||
resolution: {integrity: sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
tunnel@0.0.6:
|
||||
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
|
||||
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
|
||||
|
||||
type-fest@1.4.0:
|
||||
resolution: {integrity: sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==}
|
||||
engines: {node: '>=10'}
|
||||
@ -1160,6 +1184,10 @@ packages:
|
||||
undici-types@6.19.8:
|
||||
resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
|
||||
|
||||
undici@5.28.4:
|
||||
resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==}
|
||||
engines: {node: '>=14.0'}
|
||||
|
||||
unicode-emoji-modifier-base@1.0.0:
|
||||
resolution: {integrity: sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==}
|
||||
engines: {node: '>=4'}
|
||||
@ -1235,6 +1263,22 @@ packages:
|
||||
|
||||
snapshots:
|
||||
|
||||
'@actions/core@1.11.1':
|
||||
dependencies:
|
||||
'@actions/exec': 1.1.1
|
||||
'@actions/http-client': 2.2.3
|
||||
|
||||
'@actions/exec@1.1.1':
|
||||
dependencies:
|
||||
'@actions/io': 1.1.3
|
||||
|
||||
'@actions/http-client@2.2.3':
|
||||
dependencies:
|
||||
tunnel: 0.0.6
|
||||
undici: 5.28.4
|
||||
|
||||
'@actions/io@1.1.3': {}
|
||||
|
||||
'@babel/code-frame@7.25.7':
|
||||
dependencies:
|
||||
'@babel/highlight': 7.25.7
|
||||
@ -1252,6 +1296,8 @@ snapshots:
|
||||
'@colors/colors@1.5.0':
|
||||
optional: true
|
||||
|
||||
'@fastify/busboy@2.1.1': {}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
dependencies:
|
||||
'@nodelib/fs.stat': 2.0.5
|
||||
@ -2314,6 +2360,8 @@ snapshots:
|
||||
|
||||
traverse@0.6.8: {}
|
||||
|
||||
tunnel@0.0.6: {}
|
||||
|
||||
type-fest@1.4.0: {}
|
||||
|
||||
type-fest@2.19.0: {}
|
||||
@ -2325,6 +2373,10 @@ snapshots:
|
||||
|
||||
undici-types@6.19.8: {}
|
||||
|
||||
undici@5.28.4:
|
||||
dependencies:
|
||||
'@fastify/busboy': 2.1.1
|
||||
|
||||
unicode-emoji-modifier-base@1.0.0: {}
|
||||
|
||||
unicorn-magic@0.1.0: {}
|
||||
|
Reference in New Issue
Block a user