opendtu-logger/.gitea/workflows/go.yml

50 lines
2.5 KiB
YAML
Raw Normal View History

2024-02-21 19:05:56 +01:00
name: Build Golang packages
on:
2024-02-21 19:02:51 +01:00
push:
2024-02-21 19:05:56 +01:00
branches:
- "**"
2024-02-21 19:02:51 +01:00
tags:
2024-02-21 19:05:56 +01:00
- "v*.*.*"
pull_request:
branches:
- "main"
2024-02-21 19:02:51 +01:00
jobs:
release:
2024-02-21 20:08:30 +01:00
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-docker
2024-02-21 19:02:51 +01:00
steps:
2024-02-21 19:27:14 +01:00
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup go
2024-02-21 19:10:20 +01:00
uses: actions/setup-go@v4
2024-02-21 19:02:51 +01:00
with:
2024-02-21 19:34:31 +01:00
go-version: '>=1.22'
2024-02-21 19:38:37 +01:00
cache: false
2024-02-21 19:02:51 +01:00
- name: release-build-linux-amd64
2024-02-21 20:09:59 +01:00
run: GOOS=linux GOARCH=amd64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-linux-amd64
2024-03-27 10:05:25 +01:00
- name: release-build-linux-386
run: GOOS=linux GOARCH=386 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-linux-386
2024-02-21 19:02:51 +01:00
- name: release-build-linux-arm64
2024-02-21 20:09:59 +01:00
run: GOOS=linux GOARCH=arm64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-linux-arm64
2024-03-27 10:10:54 +01:00
- name: release-build-linux-arm
run: GOOS=linux GOARCH=arm go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-linux-arm
2024-03-27 10:12:10 +01:00
- name: release-build-linux-riscv64
run: GOOS=linux GOARCH=riscv64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-linux-riscv64
2024-03-27 10:10:54 +01:00
2024-02-21 19:02:51 +01:00
- name: release-build-windows-amd64
2024-02-21 20:09:59 +01:00
run: GOOS=windows GOARCH=amd64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-windows-amd64.exe
2024-02-21 19:02:51 +01:00
- name: release-build-windows-arm64
2024-02-21 20:09:59 +01:00
run: GOOS=windows GOARCH=arm64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-windows-arm64.exe
2024-03-27 10:10:54 +01:00
2024-02-21 19:02:51 +01:00
- name: release-build-darwin-amd64
2024-02-21 20:09:59 +01:00
run: GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-darwin-amd64
2024-02-21 19:02:51 +01:00
- name: release-build-darwin-arm64
2024-02-21 20:09:59 +01:00
run: GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-darwin-arm64
2024-02-21 19:02:51 +01:00
2024-02-21 20:06:09 +01:00
- name: Create release
2024-02-21 19:46:00 +01:00
uses: https://gitea.com/actions/release-action@main
2024-02-21 19:34:31 +01:00
with:
files: |-
bin/**
2024-02-21 20:06:09 +01:00
api_key: '${{secrets.RELEASE_TOKEN}}'