From b7bb24fb709ecb691084216b22a5cb58c9513259 Mon Sep 17 00:00:00 2001 From: clawbot Date: Mon, 9 Mar 2026 00:10:56 -0700 Subject: [PATCH] ci: add Gitea Actions workflow (.gitea/workflows/ci.yml) - Build + test on push/PR - Release pipeline on release/* tags - Failure issue creation via Gitea API --- .gitea/workflows/ci.yml | 76 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..6d742db --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,76 @@ +name: Action Gateway CI/CD + +on: + push: + branches: [main] + pull_request: + branches: [main] + push: + tags: + - 'release/*' + +jobs: + build-and-test: + name: Build & Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Build + run: cargo build --release + + - name: Run tests + run: cargo test + + - name: Check formatting + run: cargo fmt --check + + - name: Clippy + run: cargo clippy -- -D warnings + + release: + name: Publish Release + runs-on: ubuntu-latest + needs: build-and-test + if: startsWith(github.ref, 'refs/tags/release/') + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Build release binary + run: cargo build --release + + - name: Extract tag + id: tag + run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Create Gitea release with binary + run: | + RELEASE=$(curl -s -X POST "$GITEA_URL/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"tag_name\": \"${{ steps.tag.outputs.TAG }}\", + \"name\": \"Action Gateway ${{ steps.tag.outputs.TAG }}\", + \"body\": \"Automated release\\n\\nCommit: ${{ github.sha }}\", + \"draft\": false + }") + RELEASE_ID=$(echo $RELEASE | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") + + curl -s -X POST "$GITEA_URL/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases/$RELEASE_ID/assets" \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "attachment=@target/release/action-gateway;filename=action-gateway-linux-amd64" + env: + GITEA_URL: https://git.dominat.us + GITEA_OWNER: clawbot + GITEA_REPO: action-gateway + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}