8 Commits

Author SHA1 Message Date
a5aee42853 chore(release): 1.2.0 [skip ci]
# [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](1ae25ac339))
2024-10-09 12:05:27 +08:00
1ae25ac339 feat: log semantic release result in a grouped output 2024-10-09 12:04:57 +08:00
b08b8428f7 chore(release): 1.1.1 [skip ci]
## [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](64aca0ecbf))
2024-10-06 23:50:38 +08:00
64aca0ecbf fix: update action reference and enhance documentation 2024-10-06 23:50:10 +08:00
10d482c085 chore(release): 1.1.0 [skip ci]
# [1.1.0](https://github.com/yanhao98/semantic-release-example/compare/v1.0.0...v1.1.0) (2024-10-06)

### Features

* A ([a759e22](a759e22efe))
* dynamically import '@actions/core' in runRelease function ([ee0a168](ee0a168f6e))
2024-10-06 23:29:16 +08:00
ee0a168f6e feat: dynamically import '@actions/core' in runRelease function 2024-10-06 23:28:48 +08:00
0567b9b813 Merge remote-tracking branch 'origin/main' 2024-10-06 23:26:18 +08:00
a759e22efe feat: A 2024-10-06 23:25:52 +08:00
8 changed files with 158 additions and 6 deletions

View File

@ -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 }}

View File

@ -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)

View File

@ -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)

View File

@ -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'

View File

@ -4,12 +4,15 @@ 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',
'@actions/core',
].join(' ');
const { stdout, stderr } = await exec(`npm install ${deps} --no-audit --no-save`, {
cwd: self_cwd
});
@ -17,16 +20,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();

View File

@ -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

View File

@ -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
View File

@ -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: {}