-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (62 loc) · 2.27 KB
/
Copy pathrelease.yml
File metadata and controls
70 lines (62 loc) · 2.27 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
name: Release
# Publish a GitHub Release whenever a version tag is pushed:
# git tag v0.1.0 && git push origin v0.1.0
on:
push:
tags:
- "v*"
permissions:
contents: write # needed to create the Release and upload the DMG
jobs:
release:
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # full history so build.sh can derive CFBundleVersion
- name: Resolve version from tag
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
# Only an explicit pre-release suffix (e.g. 1.0.0-beta) is a GitHub
# pre-release. 0.x ships as a normal release so the newest always
# shows as "Latest" on the repo page and /releases/latest resolves.
if [[ "$VERSION" == *-* ]]; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Run tests
run: swift test
- name: Build DMG
env:
LLMFLEX_VERSION: ${{ steps.version.outputs.version }}
run: ./scripts/package-dmg.sh
- name: Extract release notes from CHANGELOG
id: notes
run: |
VERSION="${{ steps.version.outputs.version }}"
# Pull the section for this version out of CHANGELOG.md, if present.
if awk -v v="$VERSION" '
$0 ~ "^## \\[" v "\\]" {flag=1; next}
/^## \[/ {flag=0}
flag {print}
' CHANGELOG.md > notes.md && [ -s notes.md ]; then
echo "→ Using CHANGELOG section for $VERSION"
else
echo "Alpha build $VERSION. See the commit history for changes." > notes.md
fi
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PRERELEASE_FLAG=""
if [[ "${{ steps.version.outputs.prerelease }}" == "true" ]]; then
PRERELEASE_FLAG="--prerelease"
fi
gh release create "${GITHUB_REF_NAME}" \
"build/LLM-Flex-${{ steps.version.outputs.version }}.dmg" \
--title "LLM Flex ${{ steps.version.outputs.version }}" \
--notes-file notes.md \
$PRERELEASE_FLAG