-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (92 loc) · 3.26 KB
/
Copy pathgithub-release.yml
File metadata and controls
100 lines (92 loc) · 3.26 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
name: github-release
on:
workflow_dispatch:
inputs:
package:
description: 'Package to release'
required: true
type: choice
options:
- serapeum-core
- serapeum-ollama
- serapeum-llama-cpp
- serapeum-openai
- serapeum-azure-openai
increment:
description: 'Version increment type'
required: true
type: choice
options:
- patch
- minor
- major
default: patch
prerelease-type:
description: 'Prerelease type (none for a stable release)'
required: false
type: choice
options:
- none
- alpha
- beta
- rc
default: none
draft:
description: 'Create as draft release'
type: boolean
default: false
release-branch:
description: 'Branch to create the release from'
required: false
default: main
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ inputs.release-branch }}
- name: Check actor is a repository admin
run: |
PERMISSION=$(gh api repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission --jq '.permission')
echo "Permission level for ${{ github.actor }}: $PERMISSION"
if [ "$PERMISSION" != "admin" ]; then
echo "::error::${{ github.actor }} is not a repository admin. Only admins can trigger releases."
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve package path
run: |
case "${{ inputs.package }}" in
serapeum-core) echo "PACKAGE_PATH=libs/core" >> $GITHUB_ENV ;;
serapeum-ollama) echo "PACKAGE_PATH=libs/providers/ollama" >> $GITHUB_ENV ;;
serapeum-llama-cpp) echo "PACKAGE_PATH=libs/providers/llama-cpp" >> $GITHUB_ENV ;;
serapeum-openai) echo "PACKAGE_PATH=libs/providers/openai" >> $GITHUB_ENV ;;
serapeum-azure-openai) echo "PACKAGE_PATH=libs/providers/azure-openai" >> $GITHUB_ENV ;;
esac
- name: Create GitHub Release
uses: serapeum-org/github-actions/actions/release/github@github-release/v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
increment: ${{ inputs.increment }}
prerelease-type: ${{ inputs.prerelease-type }}
draft: ${{ inputs.draft }}
package-manager: uv
python-version: '3.12'
install-groups: 'groups: docs dev'
config-file: ${{ env.PACKAGE_PATH }}/pyproject.toml
- name: Update lockfile after version bump
run: uv lock
- name: Commit and push updated lockfile
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add uv.lock
git diff --cached --quiet && echo "No lockfile changes" && exit 0
git commit -m "build: sync uv.lock after ${{ inputs.package }} version bump"
git push origin ${{ inputs.release-branch }}