-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (106 loc) · 3.35 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Release Package
on:
workflow_dispatch:
inputs:
dryRun:
description: 'Dry Run'
default: true
required: true
type: boolean
push:
description: 'Allow Git Push'
default: true
required: true
type: boolean
publish:
description: 'Allow Npm Publish'
default: true
required: true
type: boolean
tag:
description: 'Allow Git Tag'
default: true
required: true
type: boolean
commit:
description: 'Allow Git Commit'
default: true
required: true
type: boolean
keepLastTag:
description: 'Clean Tags & Keep Last'
default: false
required: true
type: boolean
version:
description: 'Update Version(major.minor.patch)'
default: 'patch'
required: false
type: choice
options:
- major
- minor
- patch
forceUpdatePackage:
description: 'Force Update Package (input all -> *)'
default: ''
type: string
skipUpdatePackage:
description: 'Skip Update Package (input all -> *)'
default: ''
type: string
customVersion:
description: 'Custom Version(x.x.x)'
default: ''
type: string
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup cache for Chromium binary
uses: actions/cache@v4
with:
path: ~/.cache/puppeteer/chrome
key: chromium-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Set node version to latest
uses: actions/setup-node@v4
with:
node-version: latest
cache: 'pnpm'
- name: Checkout main
run: git checkout main
- name: Sanity check
run: |
echo branch `git branch --show-current`;
echo node `node -v`;
echo node `pnpm -v`;
- name: Set git config
run: |
git config pull.rebase false
git config --global user.email "release-workflow@*.*"
git config --global user.name "Release Workflow"
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
- name: Set npm config
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
- name: Run init
run: npm run init
- name: Run release
run: >-
npm run release --
--${{ inputs.version }}
${{ !inputs.dryRun && '--no-dry-run' || '' }}
${{ !inputs.push && '--no-push' || '' }}
${{ !inputs.publish && '--no-publish' || '' }}
${{ !inputs.tag && '--no-tag' || '' }}
${{ !inputs.commit && '--no-commit' || '' }}
${{ inputs.keepLastTag && '--keep-last-tag' || '' }}
${{ inputs.forceUpdatePackage && format('--force-update-package "{0}"', inputs.forceUpdatePackage) || ''}}
${{ inputs.skipUpdatePackage && format('--skip-update-package "{0}"', inputs.skipUpdatePackage) || ''}}
${{ inputs.customVersion && format('--custom-version "{0}"', inputs.customVersion) || ''}}