-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.3 KB
/
publish.yaml
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
43
name: publish
on:
# find out the `if` condition to run workflow_dispatch
workflow_dispatch:
inputs:
name:
description: 'Hack: To identify a manual run'
default: 'Manual'
pull_request:
types: closed
jobs:
publish:
runs-on: ubuntu-latest
if: github.event.inputs.name || (github.event.pull_request.merged && !contains(github.event.pull_request.labels.*.name, 'no publish'))
steps:
- uses: actions/[email protected]
with:
ref: refs/heads/main
persist-credentials: false
- name: Install Node.js
uses: actions/[email protected]
with:
node-version: 20
- name: 'Install dependencies'
run: npm ci --ignore-scripts
- name: version_and_publish
env:
CI: true
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.LH_GITHUB_ADMIN_TOKEN }}
run: |
git config user.name $GITHUB_ACTOR
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm version major
npm publish
git push gh-origin HEAD:main --follow-tags