From 5d9c39901c4d3a971f5f13a1f53079722f3d6b98 Mon Sep 17 00:00:00 2001 From: "a.gritsenko" Date: Sun, 20 Sep 2026 20:04:41 +0300 Subject: [PATCH] Add Gitea Actions: CI tests and package release workflow Co-Authored-By: Claude Sonnet 5 --- .gitea/workflows/ci.yml | 17 +++++++++++++++++ .gitea/workflows/release.yml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..1b61c9c --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,17 @@ +name: CI + +on: + push: + branches: ['**'] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - run: go vet ./... + - run: go test ./... diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..55cf520 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,34 @@ +name: Release + +on: + push: + tags: ['v*.*.*'] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Build + run: make dist VERSION=${GITEA_REF_NAME#v} + env: + GITEA_REF_NAME: ${{ gitea.ref_name }} + + - name: Publish to package registry + env: + VERSION: ${{ gitea.ref_name }} + TOKEN: ${{ secrets.PACKAGE_TOKEN }} + BASE: ${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/hotpcalc + run: | + set -e + for f in dist/*; do + name=$(basename "$f") + echo "upload: $name" + curl -fsSL -H "Authorization: token ${TOKEN}" \ + --upload-file "$f" \ + "${BASE}/${VERSION#v}/${name}" + done