-
Notifications
You must be signed in to change notification settings - Fork 54
31 lines (30 loc) · 996 Bytes
/
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
name: NPM publish CD workflow
on:
workflow_dispatch:
inputs:
updateType:
description: "Update type ('patch', 'major', or 'minor')"
required: true
jobs:
build:
if: "!startsWith(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/[email protected]
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm test
- run: git config --global user.name "GitHub CD bot"
- run: git config --global user.email "[email protected]"
- run: npm version ${{ github.event.inputs.updateType }} -m "[ci skip] %s"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: git push --follow-tags
env:
github-token: ${{ secrets.GITHUB_TOKEN }}