Add github workflow
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.name }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
name: linux-amd64
|
||||
extension: ""
|
||||
|
||||
- goos: linux
|
||||
goarch: arm64
|
||||
name: linux-arm64
|
||||
extension: ""
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
go-version: stable
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
VERSION: ${{ github.ref_name }}
|
||||
run: |
|
||||
mkdir -p dist
|
||||
go build \
|
||||
-ldflags="-X main.version=${VERSION}" \
|
||||
-o "dist/findbaseport-${{ matrix.name }}${{ matrix.extension }}" \
|
||||
.
|
||||
|
||||
- name: Upload binary artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: findbaseport-${{ matrix.name }}
|
||||
path: dist/findbaseport-${{ matrix.name }}${{ matrix.extension }}
|
||||
archive: false
|
||||
|
||||
release:
|
||||
name: Create release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download binaries
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
pattern: findbaseport-*
|
||||
path: dist
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate checksums
|
||||
working-directory: dist
|
||||
run: |
|
||||
sha256sum * > checksums.txt
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
dist/findbaseport-*
|
||||
dist/checksums.txt
|
||||
|
||||
Reference in New Issue
Block a user