feat: add cross-compile and release pipeline
- Enhanced Makefile with cross-compilation for linux/amd64, linux/arm64, darwin/arm64, windows/amd64, windows/arm64 - Added GitHub Actions CI workflow for testing on all platforms - Added GitHub Actions Release workflow triggered by version tags - Added VERSION file for version tracking - Added scripts/release.sh for automated release process - Added Dockerfile for containerized builds - Added CONTRIBUTING.md with release process documentation - Added CHANGELOG.md for version tracking - Updated .gitignore to exclude build artifacts - Fixed unused variable in cmd/obm/main.go - Version now injected via ldflags (main.version, main.gitCommit, main.buildTime)
This commit is contained in:
parent
33d9a2cb2e
commit
d080e107d0
15 changed files with 1853 additions and 12 deletions
84
.github/workflows/ci.yml
vendored
Normal file
84
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
cache: true
|
||||
|
||||
- name: Download dependencies
|
||||
run: go mod download
|
||||
|
||||
- name: Run vet
|
||||
run: make vet
|
||||
|
||||
- name: Run tests
|
||||
run: make test
|
||||
|
||||
- name: Check formatting
|
||||
run: |
|
||||
if [ -n "$(gofmt -l -s .)" ]; then
|
||||
echo "Files not properly formatted:"
|
||||
gofmt -l -s .
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
run: make build
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [linux, darwin, windows]
|
||||
goarch: [amd64, arm64]
|
||||
exclude:
|
||||
# Exclude darwin/amd64 - Apple Silicon is the future
|
||||
- goos: darwin
|
||||
goarch: amd64
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
cache: true
|
||||
|
||||
- name: Build binary
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
VERSION=$(cat VERSION)
|
||||
BINARY_NAME="obm"
|
||||
if [ "$GOOS" = "windows" ]; then
|
||||
BINARY_NAME="obm.exe"
|
||||
fi
|
||||
LDFLAGS="-s -w -X main.version=$VERSION"
|
||||
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "$LDFLAGS" -o "bin/${GOOS}_${GOARCH}/$BINARY_NAME" ./cmd/obm
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: obm-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: bin/${{ matrix.goos }}_${{ matrix.goarch }}/
|
||||
retention-days: 7
|
||||
154
.github/workflows/release.yml
vendored
Normal file
154
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build binaries
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# Linux
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
platform: linux-amd64
|
||||
- goos: linux
|
||||
goarch: arm64
|
||||
platform: linux-arm64
|
||||
# macOS (Apple Silicon only)
|
||||
- goos: darwin
|
||||
goarch: arm64
|
||||
platform: darwin-arm64
|
||||
# Windows
|
||||
- goos: windows
|
||||
goarch: amd64
|
||||
platform: windows-amd64
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
platform: windows-arm64
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
cache: true
|
||||
|
||||
- name: Get version
|
||||
id: version
|
||||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build binary
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.VERSION }}
|
||||
BINARY_NAME="obm"
|
||||
if [ "$GOOS" = "windows" ]; then
|
||||
BINARY_NAME="obm.exe"
|
||||
fi
|
||||
LDFLAGS="-s -w -X main.version=$VERSION"
|
||||
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "$LDFLAGS" -o "$BINARY_NAME" ./cmd/obm
|
||||
|
||||
- name: Create archive
|
||||
run: |
|
||||
BINARY_NAME="obm"
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||
BINARY_NAME="obm.exe"
|
||||
zip -j "obm-${{ matrix.platform }}.zip" "$BINARY_NAME"
|
||||
else
|
||||
tar -czf "obm-${{ matrix.platform }}.tar.gz" "$BINARY_NAME"
|
||||
fi
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: obm-${{ matrix.platform }}
|
||||
path: |
|
||||
obm-${{ matrix.platform }}.tar.gz
|
||||
obm-${{ matrix.platform }}.zip
|
||||
retention-days: 1
|
||||
if-no-files-found: warn
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get version
|
||||
id: version
|
||||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: List artifacts
|
||||
run: find artifacts -type f
|
||||
|
||||
- name: Create checksums
|
||||
run: |
|
||||
cd artifacts
|
||||
find . -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec sha256sum {} \; > ../checksums.txt
|
||||
cat ../checksums.txt
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: Release ${{ steps.version.outputs.VERSION }}
|
||||
body: |
|
||||
## obm ${{ steps.version.outputs.VERSION }}
|
||||
|
||||
OpenBoatMobile CLI tool for deploying AI agent infrastructure.
|
||||
|
||||
### Platforms
|
||||
- `linux-amd64` - Linux (x86_64)
|
||||
- `linux-arm64` - Linux (ARM64/AArch64)
|
||||
- `darwin-arm64` - macOS (Apple Silicon)
|
||||
- `windows-amd64` - Windows (x86_64)
|
||||
- `windows-arm64` - Windows (ARM64)
|
||||
|
||||
### Installation
|
||||
|
||||
**Linux/macOS:**
|
||||
```bash
|
||||
# Download and extract
|
||||
curl -sL https://github.com/openboatmobile/obm/releases/download/${{ steps.version.outputs.VERSION }}/obm-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/amd64/').tar.gz | tar xz
|
||||
chmod +x obm
|
||||
sudo mv obm /usr/local/bin/
|
||||
```
|
||||
|
||||
**Windows:**
|
||||
Download the appropriate `.zip` file, extract, and add to PATH.
|
||||
|
||||
### Usage
|
||||
```bash
|
||||
obm --help
|
||||
obm deploy # Interactive deployment wizard
|
||||
obm validate # Validate configuration
|
||||
obm status # Check infrastructure health
|
||||
```
|
||||
files: |
|
||||
artifacts/**/obm-*.tar.gz
|
||||
artifacts/**/obm-*.zip
|
||||
checksums.txt
|
||||
draft: false
|
||||
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }}
|
||||
generate_release_notes: false
|
||||
Loading…
Add table
Add a link
Reference in a new issue