-
Notifications
You must be signed in to change notification settings - Fork 27
106 lines (95 loc) · 3.29 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# This workflow will release the packages.
name: 🚀 Release
on:
workflow_dispatch:
inputs:
version:
type: choice
description: Choose which version to bump before release
default: 'Auto'
options:
- Auto
- Major
- Minor
- Patch
preRelease:
description: |
The pre-release identifier for the version.
For example, if the version is "1.2.3-beta.1", the pre-release identifier is "beta.1".
default: ""
type: string
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
GH_TOKEN: ${{ secrets.UI_BOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
release:
name: 📦 Release
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [lts/*]
pnpm-version: [8.15.7]
steps:
- name: ⬇️ Checkout
id: checkout
uses: actions/[email protected]
with:
fetch-depth: 0
token: ${{ env.GH_TOKEN }}
- name: 🟢 Setup node
id: setup-node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: 🥡 Setup pnpm
id: setup-pnpm
uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
run_install: false
- name: 🎈 Get pnpm store directory
id: get-pnpm-cache-dir
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: 🧩 Install Dependencies
id: install-dependencies
run: pnpm install
- name: 🏗️ Build
id: build
run: pnpm build
- name: 📢 Release & Publish
id: release-and-publish
run: |
git config user.name "wso2-ui-bot"
git config user.email "[email protected]"
echo "//registry.npmjs.org/:_authToken=${{ env.NPM_TOKEN }}" >> ~/.npmrc
if [ "${{ github.event.inputs.version }}" = "Major" ]; then
if [ -n "${{ github.event.inputs.preRelease }}" ]; then
npm run release -- major --preRelease="${{ github.event.inputs.preRelease }}" --ci
else
npm run release -- major --ci
fi
elif [ "${{ github.event.inputs.version }}" = "Minor" ]; then
if [ -n "${{ github.event.inputs.preRelease }}" ]; then
npm run release -- minor --preRelease="${{ github.event.inputs.preRelease }}" --ci
else
npm run release -- minor --ci
fi
elif [ "${{ github.event.inputs.version }}" = "Patch" ]; then
if [ -n "${{ github.event.inputs.preRelease }}" ]; then
npm run release -- patch --preRelease="${{ github.event.inputs.preRelease }}" --ci
else
npm run release -- patch --ci
fi
else
if [ -n "${{ github.event.inputs.preRelease }}" ]; then
npm run release -- --preRelease="${{ github.event.inputs.preRelease }}" --ci
else
npm run release -- --ci
fi
fi
env:
NPM_TOKEN: ${{ env.NPM_TOKEN }}
GITHUB_TOKEN: ${{ env.GH_TOKEN }}