rony-llm-agent/.forgejo/workflows/release.yml
2026-08-02 23:21:04 -07:00

102 lines
2.7 KiB
YAML

name: release
on:
push:
tags:
- 'v*.*.*'
- 'v*.*.*-*'
jobs:
build:
name: Build (${{ matrix.os }}/${{ matrix.arch }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: linux
arch: amd64
ext: ''
- os: linux
arch: arm64
ext: ''
- os: darwin
arch: amd64
ext: ''
- os: darwin
arch: arm64
ext: ''
- os: windows
arch: amd64
ext: '.exe'
- os: windows
arch: arm64
ext: '.exe'
steps:
- name: Checkout
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
run: |
set -euo pipefail
HOST=${GITHUB_SERVER_URL#http://}
git clone "http://x-access-token:${FORGEJO_TOKEN}@${HOST}/${GITHUB_REPOSITORY}.git" .
git checkout "$GITHUB_SHA"
- name: Setup Go
uses: https://code.forgejo.org/actions/setup-go@v5
with:
go-version: '1.26'
- name: Build binary
env:
VERSION: ${{ github.ref_name }}
run: |
set -euo pipefail
mkdir -p dist
OUT="dist/rony-llm-agent-${VERSION}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}"
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} \
go build -trimpath \
-ldflags "-s -w -X main.version=${VERSION}" \
-o "$OUT" \
./cmd/rony-llm-agent
echo "Built $OUT"
ls -lh "$OUT"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: rony-llm-agent-${{ matrix.os }}-${{ matrix.arch }}
path: dist/rony-llm-agent-*
if-no-files-found: error
release:
name: Publish release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Flatten artifacts
run: |
mkdir -p release
find dist -type f -name 'rony-llm-agent-*' -exec mv {} release/ \;
ls -lh release/
- name: Generate checksums
run: |
cd release
sha256sum * > SHA256SUMS
ls -lh
- name: Create Forgejo release
uses: https://code.forgejo.org/actions/forgejo-release@v2
with:
url: ${{ github.server_url }}
token: ${{ secrets.FORGEJO_TOKEN }}
tag: ${{ github.ref_name }}
release-dir: release
prerelease: ${{ contains(github.ref_name, '-') }}
release-notes: "Release ${{ github.ref_name }}"