-
Notifications
You must be signed in to change notification settings - Fork 658
235 lines (235 loc) · 9.46 KB
/
create-releases.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
name: release
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release type'
required: true
type: choice
default: 'patch'
options:
- major
- minor
- patch
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
env:
LINES: 120
COLUMNS: 120
OPENLLM_DO_NOT_TRACK: True
PYTHONUNBUFFERED: '1'
HATCH_VERBOSE: 2
jobs:
release:
if: github.repository_owner == 'bentoml'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/[email protected]
with:
fetch-depth: 0
token: ${{ secrets.OPENLLM_PAT }}
- uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1
with:
bentoml-version: 'main'
python-version-file: .python-version-default
- name: Import bot's GPG key for signing commits
id: import-gpg
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # ratchet:crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Install jq and curl
run: sudo apt-get install -y jq curl
- name: Create a release
env:
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
pip install ghapi inflection tomlkit orjson
./.github/actions/release.sh --release ${{ inputs.release_type }}
- name: Set project version
id: version
run: |-
version="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
echo "Release version: $version"
echo "version=$version" >> $GITHUB_OUTPUT
compile-pypi:
if: github.repository_owner == 'bentoml'
needs:
- release
name: Compile PyPI distribution for OpenLLM
uses: bentoml/OpenLLM/.github/workflows/compile-pypi.yml@main # ratchet:exclude
with:
tags: ${{ needs.release.outputs.version }}
publish-python:
needs:
- compile-pypi
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/[email protected]
with:
ref: '${{ needs.release.outputs.version }}'
token: ${{ secrets.OPENLLM_PAT }}
# NOTE: Keep this section in sync with compile-pypi.yml
- name: Download Python artifacts
uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # ratchet:actions/download-artifact@v3
with:
name: python-artefacts
path: dist
# - name: Download Linux x86_64 compiled artifacts
# uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # ratchet:actions/download-artifact@v3
# with:
# name: linux-x86_64-mypyc-wheels
# path: dist
# - name: Download MacOS x86_64 compiled artifacts
# uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # ratchet:actions/download-artifact@v3
# with:
# name: macos-x86_64-mypyc-wheels
# path: dist
# - name: Download MacOS arm64 compiled artifacts
# uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # ratchet:actions/download-artifact@v3
# with:
# name: macos-arm64-mypyc-wheels
# path: dist
# - name: Download MacOS universal2 compiled artifacts
# uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # ratchet:actions/download-artifact@v3
# with:
# name: macos-universal2-mypyc-wheels
# path: dist
- name: Smoke test compiled artefacts
run: ls -R dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # ratchet:pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
prepare-next-dev-cycle:
needs:
- release
- publish-python
- binary-distribution
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/[email protected]
with:
fetch-depth: 0
- name: Setup python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # ratchet:actions/[email protected]
with:
python-version-file: .python-version-default
- name: Install dependencies
run: pip install hatch towncrier
- name: Install jq and curl
run: sudo apt-get install -y jq curl
- name: Import bot's GPG key for signing commits
id: import-gpg-key
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # ratchet:crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Bump version to dev
env:
GIT_AUTHOR_NAME: ${{ steps.import-gpg-key.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg-key.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
run: |
git pull --autostash --no-edit --gpg-sign --ff origin main
SEMVER="${{ needs.release.outputs.version }}"
SEMVER="${SEMVER#v}"
OLD_IFS=$IFS
IFS='.'
read -ra VERSION_BITS <<< "$SEMVER"
IFS=$OLD_IFS
VNUM1=${VERSION_BITS[0]}
VNUM2=${VERSION_BITS[1]}
VNUM3=${VERSION_BITS[2]}
VNUM3=$((VNUM3+1))
DEV_VERSION="$VNUM1.$VNUM2.$VNUM3.dev0"
echo "Bumping version to ${DEV_VERSION}..."
jq --arg release_version "${DEV_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
pushd openllm-node &>/dev/null
jq --arg release_version "${DEV_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
popd &>/dev/null
git add package.json openllm-node/package.json && git commit -S -sm "infra: bump to dev version of ${DEV_VERSION} [generated] [skip ci]"
git push origin HEAD:main
binary-distribution:
if: github.repository_owner == 'bentoml'
needs: compile-pypi
name: Create binary/wheels distribution
uses: bentoml/OpenLLM/.github/workflows/binary-releases.yml@main # ratchet:exclude
release-notes:
if: github.repository_owner == 'bentoml'
needs:
- release
- publish-python
- binary-distribution
name: Create release notes and setup for next cycle
uses: bentoml/OpenLLM/.github/workflows/release-notes.yml@main # ratchet:exclude
with:
tags: ${{ needs.release.outputs.version }}
bump-homebrew-tap:
needs:
- release-notes
- prepare-next-dev-cycle
- release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/[email protected]
with:
fetch-depth: 0
- uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1
with:
bentoml-version: 'main'
python-version-file: .python-version-default
- name: Install jq and curl
run: sudo apt-get install -y jq curl
- name: Import bot's GPG key for signing commits
id: import-gpg-key
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # ratchet:crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Update current formula
env:
GIT_AUTHOR_NAME: ${{ steps.import-gpg-key.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg-key.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
run: |
git pull --autostash --no-edit --gpg-sign --ff origin main
SEMVER="${{ needs.release.outputs.version }}"
SEMVER="${SEMVER#v}"
pip install fs jinja2 ghapi plumbum
./tools/update-brew-tap.py
git add Formula && git commit -S -sm "infra: bump to homebrew tap release to ${SEMVER} [generated] [skip ci]"
git push origin HEAD:main