-
Notifications
You must be signed in to change notification settings - Fork 372
227 lines (195 loc) · 7.49 KB
/
scheduled-release.yml
File metadata and controls
227 lines (195 loc) · 7.49 KB
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
name: Release vLLM Production Stack
on:
# Run every Monday at 16:00 UTC
schedule:
- cron: '0 16 * * 1'
# Allow manual triggering for testing and off-cycle releases
workflow_dispatch:
inputs:
release_type:
description: 'Release type (patch, minor, major)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
dry_run:
description: 'Dry run (no actual release)'
required: false
default: false
type: boolean
jobs:
prepare-release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
new_version: ${{ steps.bump-version.outputs.new_version }}
current_version: ${{ steps.bump-version.outputs.current_version }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install semver pyyaml uv
- name: Determine Version Bump Type
id: bump-type
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "bump_type=${{ github.event.inputs.release_type }}" >> "$GITHUB_OUTPUT"
else
echo "bump_type=patch" >> "$GITHUB_OUTPUT"
fi
- name: Bump Version
id: bump-version
run: |
# Get current version from Chart.yaml
CURRENT_VERSION=$(grep -oP 'version: \K[0-9]+\.[0-9]+\.[0-9]+' helm/Chart.yaml)
# Calculate new version based on bump type
BUMP_TYPE="${{ steps.bump-type.outputs.bump_type }}"
# Use semver to calculate new version
NEW_VERSION=$(python -c "import semver; v = semver.VersionInfo.parse('${CURRENT_VERSION}'); print(getattr(v, 'bump_${BUMP_TYPE}')())")
{
echo "current_version=${CURRENT_VERSION}"
echo "new_version=${NEW_VERSION}"
} >> "$GITHUB_OUTPUT"
echo "Current version: ${CURRENT_VERSION}"
echo "New version: ${NEW_VERSION}"
# Exit early if this is a dry run
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
echo "DRY RUN: Would bump version from ${CURRENT_VERSION} to ${NEW_VERSION}"
exit 0
fi
# Update version in Chart.yaml only
sed -i "s/version: ${CURRENT_VERSION}/version: ${NEW_VERSION}/" helm/Chart.yaml
# Commit the version bump
git add helm/Chart.yaml
git commit -m "Bump Helm chart version to ${NEW_VERSION}"
git push
- name: Create Release Tag
if: ${{ github.event.inputs.dry_run != 'true' }}
run: |
NEW_VERSION="${{ steps.bump-version.outputs.new_version }}"
git tag -a "vllm-stack-${NEW_VERSION}" -m "Release vllm-stack-${NEW_VERSION}"
git push origin "vllm-stack-${NEW_VERSION}"
release-helm:
needs: prepare-release
if: ${{ github.event.inputs.dry_run != 'true' }}
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.7.0
with:
skip_existing: false
packages_with_index: true
charts_dir: "."
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Get PR List and Update Release
run: |
# Get the tags of the previous and the current releases
PREVIOUS_TAG="vllm-stack-${{ needs.prepare-release.outputs.current_version }}"
NEW_TAG="vllm-stack-${{ needs.prepare-release.outputs.new_version }}"
# Get the timestamp of the previous tag, fallback to epoch if tag doesn't exist
if git rev-parse "$PREVIOUS_TAG" >/dev/null 2>&1; then
PREVIOUS_TAG_DATE=$(git log -1 --format="%aI" "$PREVIOUS_TAG")
else
PREVIOUS_TAG_DATE="1970-01-01T00:00:00Z"
fi
# Get list of merged PRs between the previous release and current HEAD
PR_LIST=$(gh pr list --state merged --base main --json number,title,author,mergedAt --jq ".[] | select(.mergedAt >= \"$PREVIOUS_TAG_DATE\") | .title + \" by @\" + .author.login + \" #\" + (.number | tostring)")
# Format PR list with bullet points
CHANGE_LIST=$(echo "$PR_LIST" | while IFS= read -r line; do echo "* $line"; done)
# Debug: Check what we found
echo "Previous tag: $PREVIOUS_TAG"
echo "New tag: $NEW_TAG"
echo "Change list:"
echo "$CHANGE_LIST"
# Create release notes file
{
echo "The stack deployment of vLLM"
echo ""
echo "## What's Changed"
echo ""
echo "$CHANGE_LIST"
} > release_notes.md
# Debug: Show the release notes content
echo "Release notes content:"
cat release_notes.md
# Update the release created by chart-releaser with our commit list
gh release edit "$NEW_TAG" --notes-file release_notes.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-docker:
needs: prepare-release
if: ${{ github.event.inputs.dry_run != 'true' }}
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login to GitHub Container Registry (GHCR)
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: docker.io
username: lmcache
password: ${{ secrets.LMCACHE_DOCKER_SECRET }}
- name: Extract and sanitize version
id: version
run: |
pip install uv
raw_version=$(uv run python -c 'from vllm_router.version import __version__; print(__version__)')
sanitized_version=${raw_version//+/-}
echo "version=$sanitized_version" >> "$GITHUB_ENV"
echo "Sanitized version: $sanitized_version"
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}/router:latest
ghcr.io/${{ github.repository }}/router:${{ env.version }}
ghcr.io/${{ github.repository }}/router:${{ github.sha }}
lmcache/lmstack-router:latest
lmcache/lmstack-router:${{ env.version }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/router:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/router:buildcache,mode=max