-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (123 loc) Β· 4.52 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: π Release
on:
workflow_dispatch:
inputs:
version:
description: Version
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
prepare:
if: ${{ github.event.inputs.version != '' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: π Set all monorepo's package version
run: |
node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./package.json')); package.version = '${{ github.event.inputs.version }}'; fs.writeFileSync('./package.json', JSON.stringify(package, null, 4));"
node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./doc/package.json')); package.version = '${{ github.event.inputs.version }}'; fs.writeFileSync('./doc/package.json', JSON.stringify(package, null, 4));"
node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./svg/package.json')); package.version = '${{ github.event.inputs.version }}'; fs.writeFileSync('./svg/package.json', JSON.stringify(package, null, 4));"
for package in $(ls packages); do
node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./packages/$package/package.json')); package.version = '${{ github.event.inputs.version }}'; fs.writeFileSync('./packages/$package/package.json', JSON.stringify(package, null, 4));"
done
- name: π Commit and push changes
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git add -A
git commit -m "chore(release): v${{ github.event.inputs.version }}" || exit 0
git push
git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}"
git push origin v${{ github.event.inputs.version }}
release-verdaccio:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- run: |
echo "release: ${{ github.event.inputs.version }}"
- name: Checkout
uses: actions/checkout@v4
with:
ref: v${{ github.event.inputs.version }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org
- name: π Install & Build & Publish
run: |
pnpm i
pnpm generate && pnpm build
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: ${{ secrets.VERDACCIO_URL }}
scope: '@univerjs'
- name: π Install & Build & Publish
run: |
pnpm publish --access public -r --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}
release-npm:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: v${{ github.event.inputs.version }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org
- name: π Install & Build & Publish
run: |
pnpm i
pnpm generate && pnpm build
pnpm publish --access public -r --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
dispatch-docs:
needs: [release-verdaccio, release-npm]
runs-on: ubuntu-latest
steps:
- name: Invoke deployment hook
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_TOKEN }}
repository: dream-num/univer.ai
event-type: deploy
notify:
needs: [release-verdaccio, release-npm]
runs-on: ubuntu-latest
steps:
- name: Invoke deployment hook
uses: distributhor/workflow-webhook@v3
with:
webhook_url: ${{ secrets.WEBHOOK_URL }}
data: >
{
"type": "release",
"version": "v${{ github.event.inputs.version }}",
"workflow": {
"id": "${{ github.run_id }}"
},
"preview": {
"π Docs": "https://univer.ai/icons"
}
}