Skip to content

Commit 6371e59

Browse files
committed
build all release binaries on linux
1 parent 0f9009b commit 6371e59

File tree

1 file changed

+48
-36
lines changed

1 file changed

+48
-36
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,21 @@ name: Build Release Binaries
33
on:
44
release:
55
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
615

716
jobs:
817
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' }}
3421

3522
steps:
3623
- uses: actions/checkout@v4
@@ -40,18 +27,43 @@ jobs:
4027
with:
4128
go-version: 'stable'
4229

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
4835

49-
- name: Upload Release Asset
50-
uses: actions/upload-release-asset@v1
36+
- name: Build and Upload
5137
env:
5238
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
shell: bash
40+
run: |
41+
build_variants=(
42+
"linux amd64"
43+
"darwin amd64"
44+
"darwin arm64"
45+
"windows amd64"
46+
)
47+
48+
for variant in "${build_variants[@]}"; do
49+
read -r goos goarch <<< "$variant"
50+
artifact_name="agentapi-${goos}-${goarch}"
51+
52+
echo "Building for GOOS=$goos GOARCH=$goarch..."
53+
GOOS=$goos GOARCH=$goarch BINPATH="out/$artifact_name" make build
54+
done
55+
56+
- name: Upload Build Artifact
57+
if: ${{ inputs.create-artifact }}
58+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
5359
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
60+
name: agentapi-build
61+
path: ${{ github.workspace }}/out
62+
retention-days: 7
63+
64+
- name: Upload Release Assets
65+
if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/embedded-chat' }}
66+
run: gh release upload "$RELEASE_TAG" "$GITHUB_WORKSPACE"/out/* --clobber
67+
env:
68+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || 'preview' }}

0 commit comments

Comments
 (0)