From 9e5569d767d2c0b376eb34b77b0a5b0a8d7a7002 Mon Sep 17 00:00:00 2001 From: Henner Flick Date: Fri, 29 Aug 2025 19:32:06 +0200 Subject: [PATCH] Runner for automatic compiling of releases. --- .forgejo/workflows/build_release.yaml | 47 +++++++++++++++++++++++++++ README.md | 4 +++ 2 files changed, 51 insertions(+) create mode 100644 .forgejo/workflows/build_release.yaml diff --git a/.forgejo/workflows/build_release.yaml b/.forgejo/workflows/build_release.yaml new file mode 100644 index 0000000..b6693fc --- /dev/null +++ b/.forgejo/workflows/build_release.yaml @@ -0,0 +1,47 @@ +name: Build Klog Release + +on: + release: + types: [published] + +jobs: + build: + runs-on: docker # Use your Docker runner label + strategy: + matrix: + os: [linux, windows] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.22' + + - name: Build + run: | + if [ "${{ matrix.os }}" == "windows" ]; then + GOOS=windows GOARCH=amd64 go build -o klog.exe main.go + else + GOOS=linux GOARCH=amd64 go build -o klog main.go + fi + + - name: Upload release assets via Forgejo API + env: + FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} + FORGEJO_URL: https://dev.hflabs.de + REPO_OWNER: henner + REPO_NAME: kaffeeclipriv + RELEASE_ID: ${{ github.event.release.id }} + run: | + if [ "${{ matrix.os }}" == "windows" ]; then + FILE=klog.exe + else + FILE=klog + fi + curl -H "Authorization: token $FORGEJO_TOKEN" \ + -F "name=$FILE" \ + -F "attachment=@$FILE" \ + "$FORGEJO_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases/$RELEASE_ID/assets" + diff --git a/README.md b/README.md index 06765d3..dcd6420 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ git clone https://dev.hflabs.de/henner/kaffeecli.git cd klog go build -o bin/klog main.go ``` + +### Prebuilt binaries +On tagged releases, prebuilt binaries for Linux and Windows are available under the [Releases](../../releases) section. + --- ## Usage