-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (42 loc) · 1.29 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
name: Publish
on:
push:
branches: master
jobs:
unit-tests:
name: Unit Tests
uses: ./.github/workflows/unit-tests.yml
publish:
name: Publish
needs: unit-tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Get package.json
id: get-package
run: echo PACKAGE=$(cat ./package.json) >> $GITHUB_OUTPUT
- name: Get package version
id: get-package-version
run: echo VERSION="${{ fromJson(steps.get-package.outputs.PACKAGE).version }}" >> $GITHUB_OUTPUT
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Tag
run: |
git config --global user.name "ponlawat-w"
git config --global user.email "[email protected]"
git tag -fa "v${{ steps.get-package-version.outputs.VERSION }}" -m "v${{ steps.get-package-version.outputs.VERSION }}"
git push --force origin v${{ steps.get-package-version.outputs.VERSION }}