-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (36 loc) · 1.13 KB
/
Copy pathrelease.yml
File metadata and controls
37 lines (36 loc) · 1.13 KB
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
name: Publish to npm registry
on:
workflow_dispatch:
inputs:
version:
description: "version | patch | minor | major"
required: true
default: "patch"
jobs:
publish:
environment: release
runs-on: ubuntu-latest
name: 'Bump version and publish'
steps:
- uses: actions/checkout@v2
with:
ref: refs/heads/master
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- run: npm ci
- name: version and publish
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 $VERSION -m "Version %s"
npm publish
git push gh-origin master --tags
env:
CI: true
VERSION: ${{ github.event.inputs.version }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}