Skip to content

Commit dc97ff6

Browse files
committed
ci(release): add automated release workflow
1 parent 787089c commit dc97ff6

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_type:
7+
description: 'Type of version bump (patch, minor, major)'
8+
required: true
9+
default: 'patch'
10+
11+
env:
12+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # Required for conventional-changelog
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
28+
- name: Install dependencies
29+
run: npm install
30+
31+
- name: Configure Git
32+
run: |
33+
git config user.name "github-actions[bot]"
34+
git config user.email "github-actions[bot]@users.noreply.github.com"
35+
36+
- name: Bump version and create tag
37+
id: bump_version
38+
run: |
39+
npm version ${{ github.event.inputs.version_type }} -m "Release: v%s"
40+
echo "NEW_VERSION=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT
41+
42+
- name: Generate Changelog
43+
run: |
44+
npx conventional-changelog -p angular -i CHANGELOG.md -s -r 0
45+
git add CHANGELOG.md
46+
47+
- name: Commit and Push changes
48+
run: |
49+
git commit -m "docs: update CHANGELOG.md for v${{ steps.bump_version.outputs.NEW_VERSION }}"
50+
git push
51+
git push --tags
52+
53+
- name: Create GitHub Release
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
tag_name: v${{ steps.bump_version.outputs.NEW_VERSION }}
57+
name: Release v${{ steps.bump_version.outputs.NEW_VERSION }}
58+
body_path: CHANGELOG.md
59+
prerelease: false
60+
draft: false

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
"markdown-magic-transform-treefile-extended": "^1.2.1",
8080
"prettier": "^3.6.2",
8181
"prettier-plugin-packagejson": "^2.5.19",
82-
"yaml-eslint-parser": "^1.3.0"
82+
"yaml-eslint-parser": "^1.3.0",
83+
"conventional-changelog-cli": "^5.0.1"
8384
},
8485
"scriptsMeta": {
8586
"test": "Runs the test suite using Jest.",

0 commit comments

Comments
 (0)