-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.76 KB
/
Copy pathrelease.yml
File metadata and controls
58 lines (48 loc) · 1.76 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
57
58
# Bumps the version, updates CHANGELOG.md, creates a GitHub Release, and
# publishes to npm — all from a single manual trigger.
#
# ─── USAGE ────────────────────────────────────────────────────────────────────
# Actions → Release → Run workflow → pick patch / minor / major
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: Version bump
required: true
default: patch
type: choice
options: [patch, minor, major]
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write # push version commit + tag, create GitHub Release
id-token: write # OIDC token for npm trusted publishing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history so release-it can read all commits
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm
- name: Install dependencies
run: npm ci
- name: Configure git
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: Bump version, update changelog, create GitHub Release
run: npx release-it ${{ inputs.bump }} --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm
run: |
[ -n "$NPM_TOKEN" ] && npm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
npm run release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}