-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.64 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
name: Release
on:
workflow_dispatch:
inputs:
release-type:
description: "Release type"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major
- prepatch
- preminor
- premajor
- prerelease
env:
node_version: 18
concurrency:
group: release
cancel-in-progress: true
permissions: write-all
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set a npm token. REQUIRED
registry-url: 'https://registry.npmjs.org'
- name: Prepare modules
run: npm ci
- name: Run tests
run: npm test
- name: Setup Git
run: |
git config --global user.email "sikrinick@gmail.com"
git config --global user.name "${{ github.actor }}"
- name: Increment package version and add tag
run: npm version ${{ github.event.inputs.release-type }}
- name: Release Tag
id: release-tag-retriever
run: echo "release-tag=$(git describe --tags)" >> $GITHUB_OUTPUT
- name: Push commit and tag
run: git push --follow-tags
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Print Release tag
run: echo ${{ steps.release-tag-retreiver.outputs.release-tag }}