-
Notifications
You must be signed in to change notification settings - Fork 32
64 lines (58 loc) · 1.93 KB
/
cd.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
55
56
57
58
59
60
61
62
63
64
name: CD
concurrency: production
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
version:
type: choice
required: true
description: Version
options:
- conventional
- patch
- minor
- major
- prerelease
- from-package
- from-git
prerelease:
type: choice
description: Pre-release
options:
-
- canary
- beta
dryrun:
description: 'Dry-run'
type: boolean
run-name: Deploy ${{ inputs.version }} ${{ inputs.dryrun && '--dry-run' || '' }} ${{ inputs.prerelease && format('--prerelease {0}', inputs.prerelease) || '' }}
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
permissions:
contents: write
id-token: write
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-node@v4
with:
node-version: 20
# this line is required for the setup-node action to be able to run the npm publish below.
registry-url: 'https://registry.npmjs.org'
- uses: fregante/setup-git-user@v1
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npx --yes [email protected] release ${{ inputs.version }} ${{ inputs.dryrun && '--dry-run' || '' }} ${{ inputs.prerelease && format('--prerelease {0}', inputs.prerelease) || '' }} --provenance --changelog --github-release --verbose
- name: Get NPM version
id: npm-version
uses: martinbeentjes/[email protected]
- name: Released ${{ steps.npm-version.outputs.current-version}} ✨
run: echo ${{ steps.npm-version.outputs.current-version}}