-
Notifications
You must be signed in to change notification settings - Fork 60
54 lines (48 loc) · 1.51 KB
/
bump-and-release.yml
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
name: Bump version and release
on:
workflow_dispatch:
inputs:
bump-type:
type: choice
description: Bump type
default: patch
options:
- patch
- minor
- major
required: true
jobs:
bump-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Bump version
id: bump
env:
GH_ACTIONS_BOT_NAME: github-actions[bot]
GH_ACTIONS_BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
git config --local user.name $GH_ACTIONS_BOT_NAME
git config --local user.email $GH_ACTIONS_BOT_EMAIL
new_version_tag=$(npm version ${{ github.event.inputs.bump-type }})
git push origin master
git push origin $new_version_tag
echo "tag=$new_version_tag" >> $GITHUB_OUTPUT
- name: Release
uses: octokit/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
route: POST /repos/{owner}/{repo}/releases
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
tag_name: ${{ steps.bump.outputs.tag }}
generate_release_notes: true
- name: Publish to npm public registry
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish