forked from llm-d/llm-d-router
-
Notifications
You must be signed in to change notification settings - Fork 11
93 lines (82 loc) · 2.99 KB
/
Copy pathci-release.yaml
File metadata and controls
93 lines (82 loc) · 2.99 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
name: CI - Release - Docker Container Image
on:
push:
tags:
- 'v*' # Runs when a tag like v0.1.0 is pushed
release:
types: [published] # Also runs when a GitHub release is published
permissions:
contents: read
packages: write
security-events: write
jobs:
set-params:
runs-on: ubuntu-latest
outputs:
epp_name: ${{ steps.version.outputs.epp_name }}
sidecar_name: ${{ steps.version.outputs.sidecar_name }}
tag: ${{ steps.tag.outputs.tag }}
prerelease: ${{ steps.tag.outputs.prerelease }}
steps:
- name: Set image names
id: version
run: |
repo="${GITHUB_REPOSITORY##*/}"
echo "epp_name=${repo}-endpoint-picker" >> "$GITHUB_OUTPUT"
echo "sidecar_name=${repo}-disagg-sidecar" >> "$GITHUB_OUTPUT"
- name: Determine tag name
id: tag
run: |
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
echo "tag=${GITHUB_REF##refs/tags/}" >> "$GITHUB_OUTPUT"
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "tag=${GITHUB_REF##refs/tags/}" >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
PRE_RELEASE=${{ github.event_name != 'release' || github.event.release.prerelease }}
echo "prerelease=${PRE_RELEASE}" >> "$GITHUB_OUTPUT"
shell: bash
build-and-push:
needs: set-params
uses: ./.github/workflows/ci-build-images.yaml
with:
epp-image-name: ${{ needs.set-params.outputs.epp_name }}
sidecar-image-name: ${{ needs.set-params.outputs.sidecar_name }}
tag: ${{ needs.set-params.outputs.tag }}
prerelease: ${{ fromJSON(needs.set-params.outputs.prerelease) }}
chart-suffix: ""
upload-artifacts:
needs: set-params
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout source
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Setup Kubectl
uses: azure/setup-kubectl@v5
with:
version: 'latest'
- name: Build Artifacts
run: |
make artifacts BUNDLE_VERSION=${{ needs.set-params.outputs.tag }}
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
files=$(find artifacts -type f -size +0c | tr '\n' ' ')
if [ -z "$files" ]; then
echo "No artifacts to upload."
exit 0
fi
if gh release view "${{ needs.set-params.outputs.tag }}" >/dev/null 2>&1; then
gh release upload "${{ needs.set-params.outputs.tag }}" $files --clobber
else
echo "Release ${{ needs.set-params.outputs.tag }} does not exist. Creating a draft release..."
gh release create "${{ needs.set-params.outputs.tag }}" $files --draft --title "${{ needs.set-params.outputs.tag }}" --notes "Release ${{ needs.set-params.outputs.tag }}"
fi