-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (67 loc) · 2.07 KB
/
publish.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: 'Publish'
on:
workflow_dispatch:
inputs:
type:
description: 'version type:'
required: true
type: choice
default: 'minor'
options:
- patch
- minor
- major
custom_version:
description: 'custom version: x.y.z (without "v")'
required: false
tag:
description: 'tag'
run-name: Publish ${{ inputs.type }} ${{ inputs.custom_version }}
permissions:
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: 'https://registry.npmjs.org'
- name: Set Git credentials
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
always-auth: true
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Bump by version type
if: ${{ !github.event.inputs.custom_version }}
run: npm version ${{ github.event.inputs.type }}
- name: Bump by custom version
if: ${{ github.event.inputs.custom_version }}
run: npm version ${{ github.event.inputs.custom_version }}
- name: Pushing changes
uses: ad-m/github-push-action@master
with:
ssh: true
branch: ${{ github.ref }}
- name: Publushing prerelase
run: npm publish --provenance --access public --tag ${{ github.event.inputs.tag }}
if: ${{ github.event.inputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }}
- name: Publushing release
run: npm publish --provenance --access public
if: ${{ !github.event.inputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }}