Skip to content

Build and Release

Build and Release #9

Workflow file for this run

---
name: Build and Release
on:
push:
tags: ['*']
workflow_dispatch:
jobs:
build:
name: Build binaries
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: macos-latest
filename: file-watcher-macos-amd64
- os: ubuntu-latest
filename: file-watcher-ubuntu-amd64
- os: windows-latest
filename: file-watcher-windows-amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build binary
run: |
GOOS=$(echo ${{ matrix.os }} | cut -d'-' -f1)
GOARCH=amd64
go build -o ${{ matrix.filename }}
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.filename }}
path: ${{ matrix.filename }}
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: file-watcher-ubuntu-amd64
path: ./binaries
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: file-watcher-macos-amd64
path: ./binaries
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: file-watcher-windows-amd64
path: ./binaries
- name: dir ./binaries
run: |-
ls -lah ./binaries
- name: Create GitHub Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: ./binaries/*.*
generateReleaseNotes: true
makeLatest: true
name: Release ${{ github.ref_name }}