-
Notifications
You must be signed in to change notification settings - Fork 5
89 lines (76 loc) · 2.47 KB
/
release.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Release
on:
workflow_dispatch:
inputs:
dryRun:
description: 'Do a dry run to preview instead of a real release'
required: true
default: 'true'
jobs:
authorize:
name: Authorize
runs-on: ubuntu-latest
steps:
- name: ${{ github.actor }} permission check to do a release
uses: octokit/request-action@v2.0.0
with:
route: GET /repos/:repository/collaborators/${{ github.actor }}
repository: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release
runs-on: ubuntu-latest
needs: [authorize]
steps:
- name: Checkout
uses: actions/checkout@v2
# Needed for lerna version to determine last tag
- name: Fetch
run: git fetch --prune --unshallow --tags
- name: Cache Node Modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install
run: yarn install --frozen-lockfile
- name: Build
run: npx lerna exec yarn
- name: Test
run: yarn test --testPathIgnorePatterns "benchmark.test.ts"
- name: Configure Git User
run: |
git config --global user.name amplitude-sdk-bot
git config --global user.email amplitude-sdk-bot@users.noreply.github.com
- name: Release (Dry Run)
if: ${{ github.event.inputs.dryRun == 'true'}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn lerna version -m "chore(release): publish %s" \
--conventional-commits \
--no-push \
--no-git-tag-version \
--loglevel silly \
--yes
- name: Setup NPM Token
if: ${{ github.event.inputs.dryRun == 'false'}}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
- name: Release
if: ${{ github.event.inputs.dryRun == 'false'}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn lerna version -m "chore(release): publish %s" \
--conventional-commits \
--create-release github \
--loglevel silly \
--yes
yarn lerna publish from-git --yes --loglevel silly