mirror of
https://github.com/NotAShelf/watchdog.git
synced 2026-04-15 23:04:10 +00:00
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I64cbd7dfc64089c38bee4cffbbc279c96a6a6964
66 lines
1.6 KiB
YAML
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/**/*.tar.gz artifacts/**/*.zip
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|