-
Notifications
You must be signed in to change notification settings - Fork 4
56 lines (53 loc) · 1.7 KB
/
bumpversion.yml
File metadata and controls
56 lines (53 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Bump version, release, and publish
permissions:
contents: write
on:
push:
branches:
- main
jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
steps:
- name: Check out
uses: actions/checkout@v4
with:
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Dependencies
run: npm i
- name: Build
run: npm run build
- name: Get current version from package.json
id: get_current_version
run: |
PREVIOUS_VERSION=$(jq -r .version package.json)
echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
changelog_increment_filename: body.md
- name: Create GH Release
if: env.REVISION != env.PREVIOUS_VERSION
uses: softprops/action-gh-release@v1
with:
body_path: "body.md"
tag_name: ${{ env.REVISION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Authenticate with npm
if: env.REVISION != env.PREVIOUS_VERSION
run: npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
- name: Publish to npm
if: env.REVISION != env.PREVIOUS_VERSION
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm publish --access public