-
Notifications
You must be signed in to change notification settings - Fork 74
84 lines (76 loc) · 2.93 KB
/
prerelease.yml
File metadata and controls
84 lines (76 loc) · 2.93 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
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
name: Prerelase npm package
on:
schedule:
- cron: '0 20 * * 5'
workflow_dispatch:
inputs:
version:
description: '指定版本发布'
required: false
preid:
description: '指定预发布版本dist-tag(alpha、beta、rc)'
default: alpha
required: true
bump:
description: '指定版本发布变更类型(premajor、preminor、prepatch)'
required: false
forcePublish:
description: '是否强制发布,跳过版本比较'
default: true
type: boolean
required: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
# use-check-action:
# uses: JDFED/drip-form/.github/workflows/check.yml@dev
# with:
# branch: dev
publish:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: dev
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js environment
uses: actions/setup-node@v2.5.0
with:
node-version: '14'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: 'Install and build'
run: |
yarn
yarn build:prod
- name: 'set username and useEmail'
run: |
git config user.name mengshang918
git config user.email mengshang918@gmail.com
- name: 'set npm'
run: |
npm set "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}"
- name: 'lerna command forcePublish'
if: ${{github.event.inputs.forcePublish=='true'}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx lerna version ${{github.event.inputs.version}} --force-publish --yes --conventional-commits --conventional-prerelease --force-git-tag --no-private --no-changelog --amend --preid ${{github.event.inputs.preid||'alpha'}} ${{github.event.inputs.bump}}
npx lerna publish from-package --yes --dist-tag ${{github.event.inputs.preid||'alpha'}}
- name: 'lerna command forcePublish'
if: ${{github.event.inputs.forcePublish=='false'}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx lerna version ${{github.event.inputs.version}} --yes --conventional-commits --conventional-prerelease --force-git-tag --no-private --no-changelog --amend --preid ${{github.event.inputs.preid||'alpha'}} ${{github.event.inputs.bump}}
npx lerna publish from-package --yes --dist-tag ${{github.event.inputs.preid||'alpha'}}