Repository navigation
154 lines (129 loc) · 4.92 KB
/
Copy pathrelease-cli.yml
File metadata and controls
154 lines (129 loc) · 4.92 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
name: Release CLI
on:
workflow_dispatch:
inputs:
release_name:
description: "Release name to use (e.g. cli-1.2.3) when dispatching manually"
required: false
push:
tags:
- 'cli_release_[0-9]*.[0-9]*.[0-9]*'
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
build-linux:
name: Build Linux binary
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Rust
uses: ./.github/actions/rust
with:
github-token: ${{ github.token }}
- name: Build Linux binary
run: cargo build --bin chroma --release --manifest-path rust/cli/Cargo.toml
- name: Rename binary artifact for Linux
run: mv target/release/chroma ./chroma-linux
- name: Upload Linux binary artifact
uses: actions/upload-artifact@v7
with:
name: chroma-linux
path: chroma-linux
build-windows:
name: Build Windows binary
runs-on: 8core-32gb-windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Rust
uses: ./.github/actions/rust
with:
github-token: ${{ github.token }}
- name: Build Windows binary
run: cargo build --bin chroma --release --manifest-path rust/cli/Cargo.toml
- name: Rename binary artifact for Windows
shell: powershell
run: |
Move-Item -Path "target\release\chroma.exe" -Destination ".\chroma-windows.exe" -Force
# List files in the parent directory for debugging.
Get-ChildItem -Path ..
- name: Upload Windows binary artifact
uses: actions/upload-artifact@v7
with:
name: chroma-windows
path: chroma-windows.exe
build-macos:
name: Build macOS binaries (Intel & ARM64)
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Rust
uses: ./.github/actions/rust
with:
github-token: ${{ github.token }}
targets: aarch64-apple-darwin,x86_64-apple-darwin
- name: Build macOS Intel binary
run: cargo build --bin chroma --release --target x86_64-apple-darwin --manifest-path rust/cli/Cargo.toml
- name: Build macOS ARM64 binary
run: cargo build --bin chroma --release --target aarch64-apple-darwin --manifest-path rust/cli/Cargo.toml
- name: Rename macOS binaries
run: |
mv target/x86_64-apple-darwin/release/chroma ./chroma-macos-intel
mv target/aarch64-apple-darwin/release/chroma ./chroma-macos-arm64
chmod +x ./chroma-macos-intel ./chroma-macos-arm64
- name: Upload macOS Intel binary artifact
uses: actions/upload-artifact@v7
with:
name: chroma-macos-intel
path: chroma-macos-intel
- name: Upload macOS ARM64 binary artifact
uses: actions/upload-artifact@v7
with:
name: chroma-macos-arm64
path: chroma-macos-arm64
release:
name: Create GitHub Release and Attach Assets
runs-on: blacksmith-4vcpu-ubuntu-2404
needs: [ build-linux, build-windows, build-macos ]
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: artifacts
- name: Ensure all binaries are executable
run: chmod +x artifacts/* || true
- name: Determine release info
id: release_info
run: |
if [ "${GITHUB_EVENT_NAME}" = "push" ]; then
# The tag is available as refs/tags/cli_release_a.b.c.
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG#cli_release_}
echo "release_name=cli-${VERSION}" >> $GITHUB_OUTPUT
echo "tag_name=${TAG}" >> $GITHUB_OUTPUT
else
if [ -z "${{ github.event.inputs.release_name }}" ]; then
echo "::error::Manual dispatch requires a release_name input."
exit 1
fi
echo "release_name=${{ github.event.inputs.release_name }}" >> $GITHUB_OUTPUT
echo "tag_name=${{ github.event.inputs.release_name }}" >> $GITHUB_OUTPUT
fi
- name: Create GitHub release and upload assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.release_info.outputs.tag_name }}" \
"artifacts/chroma-linux/chroma-linux#chroma-linux" \
"artifacts/chroma-windows/chroma-windows.exe#chroma-windows.exe" \
"artifacts/chroma-macos-intel/chroma-macos-intel#chroma-macos-intel" \
"artifacts/chroma-macos-arm64/chroma-macos-arm64#chroma-macos-arm64" \
--target "${{ github.sha }}" \
--title "${{ steps.release_info.outputs.release_name }}" \
--notes "CLI release."