-
Notifications
You must be signed in to change notification settings - Fork 35
249 lines (230 loc) · 9.76 KB
/
publish.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: 01 - Publish
env:
access: public
npmjs-registry: https://registry.npmjs.org
github-registry: https://npm.pkg.github.com
on:
workflow_dispatch:
inputs:
tag:
type: choice
description: Which NPM tag should be assigned?
options:
- ''
- dev
- next
- latest
- lts
version: # see https://github.com/lerna/lerna/tree/main/libs/commands/version#semver-bump
type: choice
description: SemVer keyword for version bump
options:
- prerelease
- prepatch
- patch
- preminor
- minor
- premajor
- major
label: # see https://github.com/lerna/lerna/tree/main/libs/commands/version#--preid
type: choice
description: SemVer pre release label (optional)
options:
- rc
- beta
- alpha
jobs:
publish:
if: github.repository == 'public-ui/kolibri'
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: '${{env.npmjs-registry}}'
- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: 9
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store
restore-keys: |
${{ runner.os }}-pnpm-store
- name: Set NPM dist-tags
run: |
packages=(
"packages/components"
"packages/adapters/angular/v15"
"packages/adapters/angular/v16"
"packages/adapters/angular/v17"
"packages/adapters/angular/v18"
"packages/adapters/react"
"packages/adapters/react-standalone"
"packages/adapters/solid"
"packages/adapters/vue"
"packages/adapters/preact"
"packages/adapters/hydrate"
"packages/tools/kolibri-cli"
"packages/themes/default"
"packages/themes"
"packages/samples/react"
"packages/tools/visual-tests"
)
for package in "${packages[@]}"; do
pkg_name=$(jq -r '.name' "$package/package.json")
npm dist-tag add "$pkg_name@2.2.0" ${{github.event.inputs.tag}}
done
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
- name: Install
run: pnpm i --no-frozen-lockfile --no-verify-store-integrity
- name: Configure Git user
run: |
git config --local user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
git config --local user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
- name: Bump versions without dev-tag and with git push
if: github.event.inputs.tag != 'dev'
run: 'HUSKY=0 npx lerna version ${{github.event.inputs.version}} --preid=${{github.event.inputs.label}} --no-private --tag-version-prefix="" -m "chore: release %v" -y --force-publish'
- name: Bump versions with dev-tag and without git push
if: github.event.inputs.tag == 'dev'
run: 'HUSKY=0 npx lerna version prerelease --preid=$GITHUB_SHA --no-private --tag-version-prefix="" -m "chore: release %v" -y --force-publish --no-push'
- name: Build
run: pnpm -r build
- name: Build and publish components
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/components
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter angular v15
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/angular/v15
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter angular v16
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/angular/v16
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter angular v17
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/angular/v17
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter angular v18
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/angular/v18
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter react
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/react
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter react-standalone
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/react-standalone
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter solid
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/solid
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter vue
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/vue
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter preact
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/preact
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish adapter hydrate
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/adapters/hydrate
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish tools kolibri-cli
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/tools/kolibri-cli
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish theme default
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/themes/default
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish themes
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/themes
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish sample react
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/samples/react
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
- name: Build and publish tools visual-tests
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}}
working-directory: packages/tools/visual-tests
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}}
NPM_CONFIG_PROVENANCE: true
# Publish packages on GitHub packages
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: '${{env.github-registry}}'
- name: Publish designer
run: npm publish --access restricted
working-directory: packages/designer
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish sample react
run: npm publish --access restricted
working-directory: packages/samples/react
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}