mirror of
https://github.com/yanhao98/semantic-release-action.git
synced 2025-07-12 23:30:48 +08:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
6dc2e59e43 | |||
633c423764 | |||
a5aee42853 | |||
1ae25ac339 | |||
b08b8428f7 | |||
64aca0ecbf | |||
10d482c085 | |||
ee0a168f6e | |||
0567b9b813 | |||
a759e22efe |
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-action@main
|
||||
id: release
|
||||
- name: Print the new release version
|
||||
run: |
|
||||
echo ${{ steps.release.outputs.next_release_published }}
|
||||
echo ${{ steps.release.outputs.next_release_version }}
|
22
CHANGELOG.md
22
CHANGELOG.md
@ -1,3 +1,25 @@
|
||||
# [1.2.0](https://github.com/yanhao98/semantic-release-action/compare/v1.1.1...v1.2.0) (2024-10-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* log semantic release result in a grouped output ([1ae25ac](https://github.com/yanhao98/semantic-release-action/commit/1ae25ac339f009d3fc5d4da0aa5ece8d15552826))
|
||||
|
||||
## [1.1.1](https://github.com/yanhao98/semantic-release-action/compare/v1.1.0...v1.1.1) (2024-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update action reference and enhance documentation ([64aca0e](https://github.com/yanhao98/semantic-release-action/commit/64aca0ecbfe377aeb2ad1adf2efc95abbc8d2292))
|
||||
|
||||
# [1.1.0](https://github.com/yanhao98/semantic-release-example/compare/v1.0.0...v1.1.0) (2024-10-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* A ([a759e22](https://github.com/yanhao98/semantic-release-example/commit/a759e22efef869650130e3d29d72c776453f8460))
|
||||
* dynamically import '@actions/core' in runRelease function ([ee0a168](https://github.com/yanhao98/semantic-release-example/commit/ee0a168f6e0ff1c956bc1c64d0b3ca95bedd727f))
|
||||
|
||||
# 1.0.0 (2024-10-06)
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@ BREAKING CHANGE:
|
||||
|
||||
## 参考
|
||||
---
|
||||
- https://github.dev/cycjimmy/semantic-release-action
|
||||
- [Can I run semantic-release on my local machine rather than on a CI server?](https://semantic-release.gitbook.io/semantic-release/support/faq#can-i-run-semantic-release-on-my-local-machine-rather-than-on-a-ci-server)
|
||||
- [Can I use semantic-release to publish non-JavaScript packages?](https://semantic-release.gitbook.io/semantic-release/support/faq#can-i-use-semantic-release-to-publish-non-javascript-packages)
|
||||
- [pre-release-branches](https://semantic-release.gitbook.io/semantic-release/usage/workflow-configuration#pre-release-branches)
|
||||
|
@ -4,6 +4,11 @@ author: 'Your name or organization here'
|
||||
branding:
|
||||
icon: 'heart'
|
||||
color: 'red'
|
||||
outputs:
|
||||
next_release_published:
|
||||
description: '新版本是否已发布'
|
||||
next_release_version:
|
||||
description: '新版本号'
|
||||
runs:
|
||||
# pre: 'index.mjs'
|
||||
using: 'node20'
|
||||
|
24
index.mjs
24
index.mjs
@ -4,12 +4,16 @@ import { fileURLToPath } from 'node:url';
|
||||
import { promisify } from 'node:util';
|
||||
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',
|
||||
'@semantic-release/exec',
|
||||
'@actions/core',
|
||||
].join(' ');
|
||||
const { stdout, stderr } = await exec(`npm install ${deps} --no-audit --no-save`, {
|
||||
cwd: self_cwd
|
||||
});
|
||||
@ -17,16 +21,28 @@ async function installDependencies() {
|
||||
}
|
||||
|
||||
async function runRelease() {
|
||||
const core = await import('@actions/core');
|
||||
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');
|
||||
}
|
||||
await core.group('Semantic Release Result', async () => {
|
||||
core.info(`result :>> ${JSON.stringify(result, null, 2)}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.CI) await installDependencies();
|
||||
|
@ -3,8 +3,12 @@
|
||||
"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/exec": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@types/node": "^22.7.4",
|
||||
"semantic-release": "^24.1.2"
|
||||
@ -28,4 +32,4 @@
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
73
pnpm-lock.yaml
generated
73
pnpm-lock.yaml
generated
@ -7,10 +7,17 @@ settings:
|
||||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@actions/core':
|
||||
specifier: ^1.11.1
|
||||
version: 1.11.1
|
||||
devDependencies:
|
||||
'@semantic-release/changelog':
|
||||
specifier: ^6.0.3
|
||||
version: 6.0.3(semantic-release@24.1.2)
|
||||
'@semantic-release/exec':
|
||||
specifier: ^6.0.3
|
||||
version: 6.0.3(semantic-release@24.1.2)
|
||||
'@semantic-release/git':
|
||||
specifier: ^10.0.1
|
||||
version: 10.0.1(semantic-release@24.1.2)
|
||||
@ -23,6 +30,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 +58,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'}
|
||||
@ -134,6 +157,12 @@ packages:
|
||||
resolution: {integrity: sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@semantic-release/exec@6.0.3':
|
||||
resolution: {integrity: sha512-bxAq8vLOw76aV89vxxICecEa8jfaWwYITw6X74zzlO0mc/Bgieqx9kBRz9z96pHectiTAtsCwsQcUyLYWnp3VQ==}
|
||||
engines: {node: '>=14.17'}
|
||||
peerDependencies:
|
||||
semantic-release: '>=18.0.0'
|
||||
|
||||
'@semantic-release/git@10.0.1':
|
||||
resolution: {integrity: sha512-eWrx5KguUcU2wUPaO6sfvZI0wPafUKAMNC18aXY4EnNcrZL86dEmpNVnC9uMpGZkmZJ9EfCVJBQx4pV4EMGT1w==}
|
||||
engines: {node: '>=14.17'}
|
||||
@ -1140,6 +1169,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 +1193,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 +1272,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 +1305,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
|
||||
@ -1362,6 +1417,18 @@ snapshots:
|
||||
|
||||
'@semantic-release/error@4.0.0': {}
|
||||
|
||||
'@semantic-release/exec@6.0.3(semantic-release@24.1.2)':
|
||||
dependencies:
|
||||
'@semantic-release/error': 3.0.0
|
||||
aggregate-error: 3.1.0
|
||||
debug: 4.3.7
|
||||
execa: 5.1.1
|
||||
lodash: 4.17.21
|
||||
parse-json: 5.2.0
|
||||
semantic-release: 24.1.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@semantic-release/git@10.0.1(semantic-release@24.1.2)':
|
||||
dependencies:
|
||||
'@semantic-release/error': 3.0.0
|
||||
@ -2314,6 +2381,8 @@ snapshots:
|
||||
|
||||
traverse@0.6.8: {}
|
||||
|
||||
tunnel@0.0.6: {}
|
||||
|
||||
type-fest@1.4.0: {}
|
||||
|
||||
type-fest@2.19.0: {}
|
||||
@ -2325,6 +2394,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