Files
WorldTeacher/.gitea/workflows/go-release.yml
2025-11-04 15:28:26 +01:00

79 lines
2.4 KiB
YAML

name: Go Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.0)'
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Set Git identity
run: |
git config user.name "Gitea CI"
git config user.email "ci@git.theprivateserver.de"
- name: Tag release
run: |
git tag -a "v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}"
- name: Build release binaries
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gitreposetup-linux-amd64 .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o gitreposetup-linux-arm64 .
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o gitreposetup-windows-amd64.exe .
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o gitreposetup-darwin-amd64 .
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o gitreposetup-darwin-arm64 .
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
- name: Get previous tag
id: prev_tag
run: |
prev=$(git tag --sort=-v:refname | sed -n '2p' || true)
echo "tag=$prev" >> "$GITHUB_OUTPUT"
- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v6.0.1
with:
platform: "gitea"
baseURL: "http://192.168.178.110:3000"
configuration: ".gitea/changelog_config.json"
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
- name: Create Gitea Release
uses: softprops/action-gh-release@master
with:
tag_name: v${{ github.event.inputs.version }}
release_name: Release v${{ github.event.inputs.version }}
body: ${{steps.build_changelog.outputs.changelog}}
draft: false
prerelease: false
files: |
gitreposetup-*
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}