53 lines
1.9 KiB
YAML
53 lines
1.9 KiB
YAML
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
jobs:
|
|
build:
|
|
runs-on: docker
|
|
env:
|
|
CGO: 1
|
|
GOOS: linux
|
|
steps:
|
|
- name: Deep clone repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Get version
|
|
id: tag-version
|
|
shell: bash
|
|
run: |
|
|
set -x
|
|
release=$(git describe --tags --long)
|
|
previous=$(git describe --abbrev=0 --tags "${{ github.ref_name }}"^)
|
|
echo "release=$release" >> "$GITHUB_OUTPUT"
|
|
echo "previous=$previous" >> "$GITHUB_OUTPUT"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '>=1.22'
|
|
check-latest: true
|
|
- name: Build arm64
|
|
env:
|
|
GOARCH: arm64
|
|
run: |
|
|
go build -v -o ${{ github.event.repository.name }}.$GOARCH -ldflags="-s -w -X main.VERSION=${{ steps.tag-version.outputs.release}}" .
|
|
file --brief --no-sandbox ${{ github.event.repository.name }}.$GOARCH
|
|
- name: Build amd64
|
|
env:
|
|
GOARCH: amd64
|
|
run: |
|
|
go build -v -o ${{ github.event.repository.name }}.$GOARCH -ldflags="-s -w -X main.VERSION=${{ steps.tag-version.outputs.release}}" .
|
|
file --brief --no-sandbox ${{ github.event.repository.name }}.$GOARCH
|
|
- name: Create release
|
|
id: create-release
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: |-
|
|
${{ github.event.repository.name }}.arm64
|
|
${{ github.event.repository.name }}.amd64
|
|
title: ${{ steps.tag-version.outputs.release }}
|
|
body: |
|
|
[CHANGELOG](${{ github.repositoryUrl }}/${{ github.repository }}/src/tag/${{ github.ref_name }}/CHANGELOG)
|
|
[DIFF](${{ github.repositoryUrl }}/${{ github.repository}}/compare/${{ steps.tag-version.outputs.previous }}...${{ github.ref_name }})
|
|
api-key: '${{ secrets.RELEASE_TOKEN }}'
|