-
-
Notifications
You must be signed in to change notification settings - Fork 21
59 lines (59 loc) · 1.89 KB
/
publish.yml
File metadata and controls
59 lines (59 loc) · 1.89 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
59
name: Publish to NPM
on:
workflow_dispatch:
inputs:
increment:
description: "Release increment (e.g. patch, minor, major, none (for existing prereleases))"
required: false
type: choice
options:
- patch
- minor
- major
- none
prerelease:
description: "Prerelease tag (e.g. beta, alpha)"
required: false
type: string
dry-run:
description: 'Run the release without publishing for testing (set to "true")'
required: false
default: "false"
concurrency:
group: ${{ github.workflow }}
run-name: "Release (increment: ${{ github.event.inputs.increment }}, prerelease: ${{ github.event.inputs.prerelease || 'none' }}${{ github.event.inputs.dry-run == 'true' && ', dry run' || '' }})"
permissions:
id-token: write
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: npm
- name: Setup git config
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Install dependencies
run: npm ci
- name: Release package
run: |
ARGS=""
if [[ "${{ github.event.inputs.increment }}" != "none" ]]; then
ARGS+="${{ github.event.inputs.increment }}"
fi
if [[ -n "${{ github.event.inputs.prerelease }}" ]]; then
ARGS+=" --preRelease=${{ github.event.inputs.prerelease }}"
fi
if [[ "${{ github.event.inputs.dry-run }}" == "true" ]]; then
ARGS+=" --dry-run"
fi
npm run release -- $ARGS --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}