Skip to content

Commit f00bac0

Browse files
committed
build: add release ci
1 parent c1b1d79 commit f00bac0

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

.github/workflows/release.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
name: Release
9+
runs-on: ubuntu-latest
10+
environment: prod
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v6
14+
with:
15+
persist-credentials: false
16+
fetch-depth: 0
17+
18+
- name: Setup Node 16
19+
uses: actions/setup-node@v6
20+
with:
21+
node-version: 16
22+
23+
- name: Release
24+
uses: cycjimmy/semantic-release-action@v2
25+
id: semantic
26+
with:
27+
semantic_version: 18.0.0
28+
extra_plugins: |
29+
@semantic-release/changelog@6.0.0
30+
@semantic-release/git@10.0.0
31+
conventional-changelog-conventionalcommits@4.6.3
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
34+
35+
- name: Get release version
36+
id: get_version
37+
run: |
38+
if [ "${{ steps.semantic.outputs.new_release_published }}" == "true" ]; then
39+
echo "version=${{ steps.semantic.outputs.new_release_version }}" >> $GITHUB_OUTPUT
40+
else
41+
echo "version=${{ steps.semantic.outputs.last_release_version }}" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: Display Release Info
45+
run: |
46+
VERSION="${{ steps.get_version.outputs.version }}"
47+
NEW_RELEASE="${{ steps.semantic.outputs.new_release_published }}"
48+
49+
echo "::notice title=📦 Release Version::${VERSION}"
50+
51+
echo "### 🚀 Release Information" >> $GITHUB_STEP_SUMMARY
52+
echo "" >> $GITHUB_STEP_SUMMARY
53+
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
54+
echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
55+
echo "| Version | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY
56+
echo "| New Release Published | ${NEW_RELEASE} |" >> $GITHUB_STEP_SUMMARY

.releaserc.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"ci": false,
6+
"plugins": [
7+
[
8+
"@semantic-release/commit-analyzer",
9+
{
10+
"preset": "conventionalcommits"
11+
}
12+
],
13+
[
14+
"@semantic-release/release-notes-generator",
15+
{
16+
"preset": "conventionalcommits"
17+
}
18+
],
19+
[
20+
"@semantic-release/github",
21+
{
22+
"successComment": "This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:",
23+
"labels": false,
24+
"releasedLabels": false
25+
}
26+
],
27+
[
28+
"@semantic-release/changelog",
29+
{
30+
"changelogFile": "CHANGELOG.md",
31+
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file."
32+
}
33+
],
34+
[
35+
"@semantic-release/git",
36+
{
37+
"assets": [
38+
"CHANGELOG.md"
39+
],
40+
"message": "chore(release): version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
41+
}
42+
]
43+
]
44+
}

0 commit comments

Comments
 (0)