-
Notifications
You must be signed in to change notification settings - Fork 6
36 lines (32 loc) · 1.03 KB
/
npm-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
name: Publish on Release
permissions:
contents: write
on:
release:
types: [created]
env:
GENAI_DEFAULT_ENDPOINT: ${{ vars.GENAI_DEFAULT_ENDPOINT }}
jobs:
publish-npm:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: yarn install --frozen-lockfile
- name: Bump package.json version
run: |
git config --global user.email "bot@github.com"
git config --global user.name "Github Action"
git tag --delete ${{github.ref_name}}
git push --delete origin ${{github.ref_name}}
git checkout -b tmp
yarn version --new-version `echo -n ${{github.ref_name}} | tr -d "v"` --no-commit-hooks
git push origin tmp:main
git push origin ${{github.ref_name}}
- run: yarn npm publish --access public
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}