-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (79 loc) · 3.08 KB
/
release.yml
File metadata and controls
95 lines (79 loc) · 3.08 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Extract version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "version_number=${VERSION}" >> $GITHUB_OUTPUT
- name: Build binaries
env:
CHRONO_API_URL: ${{ secrets.CHRONO_API_URL }}
run: |
VERSION="${{ steps.version.outputs.version }}"
BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
COMMIT="$(git rev-parse --short HEAD)"
LDFLAGS="-X github.com/ChronoAIProject/chrono-cli/cmd.Version=${VERSION} -X github.com/ChronoAIProject/chrono-cli/cmd.BuildTime=${BUILD_TIME} -X github.com/ChronoAIProject/chrono-cli/cmd.Commit=${COMMIT} -s -w"
for GOOS in darwin linux windows; do
for GOARCH in amd64 arm64; do
if [ "$GOOS" = "windows" ]; then
OUTPUT="chrono-${GOOS}-${GOARCH}.exe"
else
OUTPUT="chrono-${GOOS}-${GOARCH}"
fi
echo "Building $OUTPUT..."
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "$LDFLAGS" -o "$OUTPUT" .
done
done
- name: Generate checksums
run: |
sha256sum chrono-* > checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Chrono CLI ${{ steps.version.outputs.version }}
body: |
## Chrono CLI ${{ steps.version.outputs.version }}
### Installation
**One-line install (macOS/Linux):**
```bash
curl -sSL https://raw.githubusercontent.com/ChronoAIProject/chrono-cli/main/install.sh | sh
```
**Or download manually:**
- [darwin-amd64](https://github.com/ChronoAIProject/chrono-cli/releases/download/${{ github.ref_name }}/chrono-darwin-amd64)
- [darwin-arm64](https://github.com/ChronoAIProject/chrono-cli/releases/download/${{ github.ref_name }}/chrono-darwin-arm64)
- [linux-amd64](https://github.com/ChronoAIProject/chrono-cli/releases/download/${{ github.ref_name }}/chrono-linux-amd64)
- [linux-arm64](https://github.com/ChronoAIProject/chrono-cli/releases/download/${{ github.ref_name }}/chrono-linux-arm64)
- [windows-amd64](https://github.com/ChronoAIProject/chrono-cli/releases/download/${{ github.ref_name }}/chrono-windows-amd64.exe)
### Verify Checksums
```bash
sha256sum -c checksums.txt
```
### Usage
```bash
chrono login
chrono init
chrono --help
```
files: |
chrono-*
checksums.txt
draft: false
prerelease: false