-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (41 loc) · 1.16 KB
/
release.yaml
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
name: Release to NPM
on:
workflow_dispatch:
inputs:
version:
type: string
description: Version to release, e.g. "v0.1.2"
required: false
push:
tags:
- 'v*.*.*'
jobs:
npm-publish:
strategy:
matrix:
language: [ js, ts ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.16.0
- name: Set version env
id: set_version
## if version is not provided as input, use the tag name
run: |
echo "tag=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
if [ -z "${{ github.event.inputs.version }}" ]; then
echo "tag=${{ github.ref }}" >> $GITHUB_OUTPUT
fi
- name: Update version of npm package
working-directory: ./${{ matrix.language }}
env:
RELEASE_VERSION: ${{ steps.set_version.outputs.tag }}
run: |
npm version $RELEASE_VERSION
- name: publish the npm package
uses: JS-DevTools/npm-publish@v2
with:
package: ./${{ matrix.language }}
token: ${{ secrets.NPM_TOKEN }}