watchdog/.github/workflows/release.yml
NotAShelf 3662adc61a
ci: upload artifacts prefixed watchdog-
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I04fc11e229a65a7517ec6337f90823756a6a6964
2026-03-10 13:19:45 +03:00

66 lines
1.6 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
strategy:
matrix:
goos: [linux, darwin, freebsd]
goarch: [amd64, arm64]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build \
-ldflags="-s -w -X main.Version=${{ github.ref_name }} -X main.Commit=${{ github.sha }}" -o watchdog-${GOOS}-${GOARCH} .
- name: Create artifact
run: |
tar -czvf watchdog-${GOOS}-${{ matrix.goarch }}.tar.gz watchdog-${GOOS}-${{ matrix.goarch }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: watchdog-${{ matrix.goos }}-${{ matrix.goarch }}
path: watchdog-*
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
pattern: watchdog-*
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/watchdog-*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}