Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build Release

on:
workflow_dispatch:
workflow_call:

jobs:
build:
name: "Build ${{ matrix.goos }} ${{ matrix.goarch }}"
runs-on: namespace-profile-ubuntu-small
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
- goos: windows
goarch: arm64
steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Install Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
# Use the Namespace Go cache
cache: false

- name: Set up build cache
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: go

- name: Build
env:
CGO_ENABLED: '0'
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
binary="oz-agent-worker"
if [ "$GOOS" = "windows" ]; then
binary="oz-agent-worker.exe"
fi
go build -o "$binary" .

- name: Archive
run: |
prefix="oz-agent-worker-${{ matrix.goos }}-${{ matrix.goarch }}"
if [ "${{ matrix.goos }}" = "windows" ]; then
zip "${prefix}.zip" oz-agent-worker.exe
else
tar czf "${prefix}.tar.gz" oz-agent-worker
tar cJf "${prefix}.tar.xz" oz-agent-worker
fi

- name: Upload artifact
uses: namespace-actions/upload-artifact@v1
with:
name: oz-agent-worker-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
oz-agent-worker-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
oz-agent-worker-${{ matrix.goos }}-${{ matrix.goarch }}.tar.xz
oz-agent-worker-${{ matrix.goos }}-${{ matrix.goarch }}.zip
32 changes: 32 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Create Release

on:
workflow_dispatch:

jobs:
build:
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: ./.github/workflows/build_release.yml

release:
needs: build
runs-on: namespace-profile-ubuntu-small
permissions:
contents: write
steps:
- name: Generate tag name
id: tag
run: echo "name=v$(date -u +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT"

- name: Download artifacts
uses: namespace-actions/download-artifact@v1
with:
path: artifacts

- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.name }}
target_commitish: ${{ github.sha }}
generate_release_notes: true
files: artifacts/**/*
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM golang:1.25-alpine AS builder
FROM golang:1.26-alpine AS builder

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/warpdotdev/oz-agent-worker

go 1.25.0
go 1.26.0

require (
github.com/alecthomas/kong v1.13.0
Expand Down
7 changes: 7 additions & 0 deletions script/test-build-release-workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Dry-run the build_release workflow locally using nektos/act.
# Usage: script/test-build-release-workflow

set -euo pipefail

act workflow_dispatch -W .github/workflows/build_release.yml --container-architecture linux/amd64 -P namespace-profile-ubuntu-small=catthehacker/ubuntu:act-latest "$@"
Loading