-
Notifications
You must be signed in to change notification settings - Fork 11
64 lines (54 loc) · 1.75 KB
/
release_packages.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
name: Release NPM packages
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
version:
description: "Version to publish, by explicit version or semver keyword."
required: true
default: patch
jobs:
release-packages:
name: 'build, test, release'
runs-on: ubuntu-latest
env:
# NPM automation token (skips 2FA)
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Master-branch check
run: |
echo "Must be on master branch to publish packages."
exit 1
if: github.ref != 'refs/heads/master'
# 1. provide Personal Access Token for checkout@v2
# GITHUB_TOKEN (personal access token) always exists in repositories, does not have to be explicitly added
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
# 2. setup .npmrc which uses NODE_AUTH_TOKEN
- name: Setup .npmrc file for publish
uses: actions/setup-node@v2
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
# 3. configure git user used to push tag
- name: Configure Git User
run: |
git config --global user.email "github-actions[bot]@users.noreply@github.com"
git config --global user.name "github-actions[bot]"
- name: Install lerna v4
run: |
rm -rf /usr/local/bin/lerna
npm install -g lerna@4.0.0
- name: Install dependencies
run: |
npm ci
lerna bootstrap
- name: Build packages
run: lerna run build
- name: Publish
run: |
lerna publish --yes --no-verify-access ${{ github.event.inputs.version }}