2024-02-22 11:42:04 +01:00
|
|
|
name: Build Golang packages
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "**"
|
|
|
|
tags:
|
|
|
|
- "v*.*.*"
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "main"
|
2023-12-05 17:37:50 +01:00
|
|
|
|
2024-02-22 11:42:04 +01:00
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
runs-on: ubuntu-docker
|
|
|
|
steps:
|
|
|
|
- name: Check out repository code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: '>=1.22'
|
|
|
|
cache: false
|
|
|
|
- name: release-build-linux-amd64
|
2024-07-25 23:03:23 +02:00
|
|
|
run: GOOS=linux GOARCH=amd64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-linux-amd64
|
|
|
|
- name: release-build-linux-386
|
|
|
|
run: GOOS=linux GOARCH=386 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-linux-386
|
2024-02-22 11:42:04 +01:00
|
|
|
- name: release-build-linux-arm64
|
2024-07-25 23:03:23 +02:00
|
|
|
run: GOOS=linux GOARCH=arm64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-linux-arm64
|
|
|
|
- name: release-build-linux-arm
|
|
|
|
run: GOOS=linux GOARCH=arm go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-linux-arm
|
|
|
|
- name: release-build-linux-riscv64
|
|
|
|
run: GOOS=linux GOARCH=riscv64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-linux-riscv64
|
|
|
|
|
2024-02-22 11:42:04 +01:00
|
|
|
- name: release-build-windows-amd64
|
2024-07-25 23:03:23 +02:00
|
|
|
run: GOOS=windows GOARCH=amd64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-windows-amd64.exe
|
2024-02-22 11:42:04 +01:00
|
|
|
- name: release-build-windows-arm64
|
2024-07-25 23:03:23 +02:00
|
|
|
run: GOOS=windows GOARCH=arm64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-windows-arm64.exe
|
|
|
|
|
2024-02-22 11:42:04 +01:00
|
|
|
- name: release-build-darwin-amd64
|
2024-07-25 23:03:23 +02:00
|
|
|
run: GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-darwin-amd64
|
2024-02-22 11:42:04 +01:00
|
|
|
- name: release-build-darwin-arm64
|
2024-07-25 23:03:23 +02:00
|
|
|
run: GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/p1-logger-${{ github.ref_name }}-darwin-arm64
|
2023-12-05 17:37:50 +01:00
|
|
|
|
2024-02-22 11:42:04 +01:00
|
|
|
- name: Create release
|
|
|
|
uses: https://gitea.com/actions/release-action@main
|
|
|
|
with:
|
|
|
|
files: |-
|
|
|
|
bin/**
|
|
|
|
api_key: '${{secrets.RELEASE_TOKEN}}'
|