-
Notifications
You must be signed in to change notification settings - Fork 6
40 lines (36 loc) · 1.12 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
37
38
39
40
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
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: yarn install --immutable
- name: Bump package.json version
run: |
git config --global user.email "[email protected]"
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 --immediate `echo -n ${{github.ref_name}} | tr -d "v"`
git add .
git commit -m "${{github.ref_name}}" --no-verify
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 }}