Add CI for binary releases.
This commit is contained in:
parent
9c4de319f9
commit
0d0ae0d213
1 changed files with 40 additions and 26 deletions
|
@ -1,28 +1,42 @@
|
|||
# # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||
# # https://github.com/goreleaser/goreleaser-action
|
||||
name: Build Golang packages
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
pull_request:
|
||||
branches:
|
||||
- "main"
|
||||
|
||||
# name: Release Go package
|
||||
# on: [push]
|
||||
|
||||
# jobs:
|
||||
|
||||
# build:
|
||||
# runs-on: ubuntu-docker
|
||||
# strategy:
|
||||
# matrix:
|
||||
# go-version: [ '1.21' ]
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# # - name: Setup Go ${{ matrix.go-version }}
|
||||
# # uses: actions/setup-go@v4
|
||||
# # with:
|
||||
# # go-version: ${{ matrix.go-version }}
|
||||
# # # You can test your matrix by printing the current Go version
|
||||
# - name: Display Go version
|
||||
# run: go version
|
||||
# - name: Run GoReleaser
|
||||
# uses: goreleaser/goreleaser-action@master
|
||||
# with:
|
||||
# version: latest
|
||||
# args: release --rm-dist
|
||||
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
|
||||
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
|
||||
- name: release-build-linux-arm64
|
||||
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
|
||||
- name: release-build-windows-amd64
|
||||
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
|
||||
- name: release-build-windows-arm64
|
||||
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
|
||||
- name: release-build-darwin-amd64
|
||||
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
|
||||
- name: release-build-darwin-arm64
|
||||
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
|
||||
|
||||
- name: Create release
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
files: |-
|
||||
bin/**
|
||||
api_key: '${{secrets.RELEASE_TOKEN}}'
|
Loading…
Reference in a new issue