-
Notifications
You must be signed in to change notification settings - Fork 2
41 lines (39 loc) · 1.23 KB
/
main.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
env:
CI_COMMIT_MESSAGE: 'ci(version-bump)'
jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Setup Git User
if: '!contains(github.event.head_commit.message, env.CI_COMMIT_MESSAGE)'
run: |
git config user.name 'GH Actions'
git config user.email '<>'
- name: Increment Build Branch and Release
if: '!contains(github.event.head_commit.message, env.CI_COMMIT_MESSAGE)'
run: |
git --version
git status
npm config set tag-version-prefix ''
version=$(npm version patch -m 'ci(version-bump): patch %s 🎉')
git push --tags
git push origin main -f
echo "LATEST_TAG=$(version)" >> $GITHUB_ENV
- name: Set up .npmrc
run: |
git pull
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_REGISTRY }}" > ~/.npmrc
npm i && npm run build
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY }}