trigger binary build on the embedded-chat branch #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Release Binaries | |
on: | |
release: | |
types: [created, published, edited] | |
push: | |
branches: [ main, embedded-chat ] | |
workflow_dispatch: | |
inputs: | |
create-artifact: | |
description: 'Create build artifact' | |
required: true | |
type: boolean | |
default: false | |
jobs: | |
build: | |
name: Build Release Binaries | |
runs-on: depot-ubuntu-22.04-4 | |
if: ${{ github.repository_owner == 'coder' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 'stable' | |
- name: Set up Bun | |
uses: oven-sh/setup-bun@v2 | |
- name: Install Chat Dependencies | |
run: cd chat && bun install | |
- name: Build and Upload | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
build_variants=( | |
"linux amd64" | |
"darwin amd64" | |
"darwin arm64" | |
"windows amd64" | |
) | |
for variant in "${build_variants[@]}"; do | |
read -r goos goarch <<< "$variant" | |
artifact_name="agentapi-${goos}-${goarch}" | |
echo "Building for GOOS=$goos GOARCH=$goarch..." | |
GOOS=$goos GOARCH=$goarch BINPATH="out/$artifact_name" make build | |
done | |
- name: Upload Build Artifact | |
if: ${{ inputs.create-artifact }} | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: agentapi-build | |
path: ${{ github.workspace }}/out | |
retention-days: 7 | |
- name: Upload Release Assets | |
if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/embedded-chat' }} | |
run: gh release upload "$RELEASE_TAG" "$GITHUB_WORKSPACE"/out/* --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || 'preview' }} |