-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (40 loc) · 1.1 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
name: Publish Package to npmjs
on:
push:
branches:
- 'main'
jobs:
tag:
runs-on: ubuntu-latest
env:
CI_COMMIT_EMAIL: username@users.noreply.github.com
CI_COMMIT_AUTHOR: CI Bot
steps:
- name: Get tag
id: get_tag
run: |
echo "version=v$(npm pkg get version | tr -d '\"')" >> $GITHUB_OUTPUT
- name: Tag the commit
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
next_version=${{ steps.get_tag.outputs.version }}
git tag -a "$next_version" -m "V $next_version"
git push origin "$next_version"
publish:
runs-on: ubuntu-latest
needs: tag
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install dependencies
run: yarn install
- run: yarn build
- run: yarn test:ci
- run: yarn prepub
- run: yarn e2e
- run: yarn pub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}