-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (138 loc) · 4.82 KB
/
release.yml
File metadata and controls
155 lines (138 loc) · 4.82 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
155
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., 0.8.4)'
required: false
default: ''
jobs:
build:
name: Build ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
goos: linux
goarch: amd64
- os: linux
arch: arm64
goos: linux
goarch: arm64
- os: darwin
arch: amd64
goos: darwin
goarch: amd64
- os: darwin
arch: arm64
goos: darwin
goarch: arm64
- os: windows
arch: amd64
goos: windows
goarch: amd64
ext: .exe
- os: windows
arch: arm64
goos: windows
goarch: arm64
ext: .exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
elif [ "${{ github.ref_type }}" = "tag" ]; then
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
else
echo "VERSION=$(cat Makefile | grep 'VERSION :=' | head -1 | cut -d'=' -f2 | tr -d ' ')" >> $GITHUB_OUTPUT
fi
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
VERSION=${{ steps.version.outputs.VERSION }}
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
LDFLAGS="-s -w -X main.version=${VERSION} -X main.commit=${GIT_COMMIT} -X main.date=${BUILD_TIME}"
BINARY_NAME="mask-ctl-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}"
mkdir -p build/bin
go build -ldflags "${LDFLAGS}" -o build/bin/${BINARY_NAME} ./cmd/coding-plan-mask
echo "BINARY_NAME=${BINARY_NAME}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mask-ctl-${{ matrix.os }}-${{ matrix.arch }}
path: build/bin/mask-ctl-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
elif [ "${{ github.ref_type }}" = "tag" ]; then
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
else
echo "VERSION=$(cat Makefile | grep 'VERSION :=' | head -1 | cut -d'=' -f2 | tr -d ' ')" >> $GITHUB_OUTPUT
fi
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: build/bin
- name: List artifacts
run: ls -la build/bin/
- name: Create SHA256 checksums
run: |
cd build/bin
sha256sum */mask-ctl-* > checksums.sha256
cat checksums.sha256
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.VERSION }}
name: Release v${{ steps.version.outputs.VERSION }}
body: |
## Changes
- Add Anthropic format compatibility mode (`use_anthropic` config)
- Add terminal logging for mock models requests
- Fix null values in JSON Schema for Anthropic protocol
## Downloads
| Platform | Architecture | File |
|----------|-------------|------|
| Linux | amd64 | mask-ctl-linux-amd64 |
| Linux | arm64 | mask-ctl-linux-arm64 |
| macOS | amd64 | mask-ctl-darwin-amd64 |
| macOS | arm64 | mask-ctl-darwin-arm64 |
| Windows | amd64 | mask-ctl-windows-amd64.exe |
| Windows | arm64 | mask-ctl-windows-arm64.exe |
files: |
build/bin/*/mask-ctl-*
checksums.sha256
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}