@@ -3,34 +3,21 @@ name: Build Release Binaries
3
3
on :
4
4
release :
5
5
types : [created, published, edited]
6
+ push :
7
+ branches : [ main ]
8
+ workflow_dispatch :
9
+ inputs :
10
+ create-artifact :
11
+ description : ' Create build artifact'
12
+ required : true
13
+ type : boolean
14
+ default : false
6
15
7
16
jobs :
8
17
build :
9
- name : Build for ${{ matrix.os }}
10
- runs-on : ${{ matrix.os }}
11
- strategy :
12
- matrix :
13
- include :
14
- - os : ubuntu-latest
15
- artifact_name : agentapi
16
- asset_name : agentapi-linux-amd64
17
- goarch : amd64
18
- goos : linux
19
- - os : macos-latest
20
- artifact_name : agentapi
21
- asset_name : agentapi-darwin-amd64
22
- goarch : amd64
23
- goos : darwin
24
- - os : macos-latest
25
- artifact_name : agentapi
26
- asset_name : agentapi-darwin-arm64
27
- goarch : arm64
28
- goos : darwin
29
- - os : windows-latest
30
- artifact_name : agentapi.exe
31
- asset_name : agentapi-windows-amd64.exe
32
- goarch : amd64
33
- goos : windows
18
+ name : Build Release Binaries
19
+ runs-on : depot-ubuntu-22.04-4
20
+ if : ${{ github.repository_owner == 'coder' }}
34
21
35
22
steps :
36
23
- uses : actions/checkout@v4
@@ -40,18 +27,42 @@ jobs:
40
27
with :
41
28
go-version : ' stable'
42
29
43
- - name : Build
44
- env :
45
- GOOS : ${{ matrix.goos }}
46
- GOARCH : ${{ matrix.goarch }}
47
- run : go build -v -o ${{ matrix.artifact_name }} .
30
+ - name : Set up Bun
31
+ uses : oven-sh/setup-bun@v2
32
+
33
+ - name : Install Chat Dependencies
34
+ run : cd chat && bun install
48
35
49
- - name : Upload Release Asset
50
- uses : actions/upload-release-asset@v1
36
+ - name : Build and Upload
51
37
env :
52
38
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
39
+ shell : bash
40
+ run : |
41
+ build_variants=(
42
+ "linux amd64 agentapi-linux-amd64"
43
+ "darwin amd64 agentapi-darwin-amd64"
44
+ "darwin arm64 agentapi-darwin-arm64"
45
+ "windows amd64 agentapi-windows-amd64.exe"
46
+ )
47
+
48
+ for variant in "${build_variants[@]}"; do
49
+ read -r goos goarch artifact_name <<< "$variant"
50
+
51
+ echo "Building for GOOS=$goos GOARCH=$goarch..."
52
+ GOOS=$goos GOARCH=$goarch BINPATH="out/$artifact_name" make build
53
+ done
54
+
55
+ - name : Upload Build Artifact
56
+ if : ${{ inputs.create-artifact }}
57
+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
53
58
with :
54
- upload_url : ${{ github.event.release.upload_url }}
55
- asset_path : ./${{ matrix.artifact_name }}
56
- asset_name : ${{ matrix.asset_name }}
57
- asset_content_type : application/octet-stream
59
+ name : agentapi-build
60
+ path : ${{ github.workspace }}/out
61
+ retention-days : 7
62
+
63
+ - name : Upload Release Assets
64
+ if : ${{ github.event_name == 'release' || github.ref == 'refs/heads/main' }}
65
+ run : gh release upload "$RELEASE_TAG" "$GITHUB_WORKSPACE"/out/* --clobber
66
+ env :
67
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
68
+ RELEASE_TAG : ${{ github.event_name == 'release' && github.event.release.tag_name || 'preview' }}
0 commit comments