forked from renovatebot/renovate
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (62 loc) · 2.22 KB
/
release-npm.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: release-npm
on:
repository_dispatch:
types: [renovate-release]
workflow_dispatch:
inputs:
sha:
description: 'Git sha to checkout'
required: true
version:
description: 'Version to release'
required: true
tag:
description: 'Npm dist-tag'
default: 'latest'
required: false
env:
NODE_VERSION: 14
GIT_SHA: ${{ github.event.client_payload.sha }}
NPM_VERSION: ${{ github.event.client_payload.version }}
NPM_TAG: ${{ github.event.client_payload.tag }}
jobs:
release-npm:
runs-on: ubuntu-latest
steps:
- name: Prepare env
run: |
if [[ "${{github.event_name}}" == "workflow_dispatch" ]]; then
echo "GIT_SHA=${{ github.event.inputs.sha }}" >> $GITHUB_ENV
echo "NPM_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "NPM_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0
with:
ref: ${{ env.GIT_SHA }}
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # renovate: tag=v2.5.1
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Init platform
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
git config --global user.email '[email protected]'
git config --global user.name 'Renovate Bot'
yarn config set version-git-tag false
npm config set scripts-prepend-node-path true
- name: Installing dependencies
run: yarn install --frozen-lockfile
- name: Build ${{ env.NPM_VERSION }}
run: yarn build
- name: Prepare ${{ env.NPM_VERSION }}
run: |
npm --no-git-tag-version version ${{ env.NPM_VERSION }}
- name: Publish ${{ env.NPM_VERSION }}
run: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ./.npmrc
npm publish --tag ${{ env.NPM_TAG }}
git checkout -- .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}