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
21 changes: 11 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
name: Go Build
name: Build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goarch: [amd64, arm64]

steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v5

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v4
with:
go-version: "1.24"
go-version: '1.24'

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest

- name: Build
run: go build .
- name: Build binary
run: |
echo "Building for ${{ matrix.goarch }}"
GOOS=linux GOARCH=${{ matrix.goarch }} go build -o observer-${{ matrix.goarch }} .
41 changes: 37 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,49 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goarch: [amd64, arm64]

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Build
run: go build -o observer .
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'

- name: Build binary
run: |
echo "Building for ${{ matrix.goarch }}"
GOOS=linux GOARCH=${{ matrix.goarch }} go build -o observer-${{ matrix.goarch }} .

- name: Package binary as tar.gz with release tag
run: |
TAG=${GITHUB_REF#refs/tags/}
tar -czf observer-${{ matrix.goarch }}-$TAG.tar.gz observer-${{ matrix.goarch }}

- name: Release
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: observer-${{ matrix.goarch }}-${GITHUB_REF#refs/tags/}.tar.gz
path: observer-${{ matrix.goarch }}-${GITHUB_REF#refs/tags/}.tar.gz

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: .

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
files: observer
files: |
observer-amd64-${GITHUB_REF#refs/tags/}.tar.gz
observer-arm64-${GITHUB_REF#refs/tags/}.tar.gz