From 2854d2a92266a9f84e16b35ed79ef51776c7ffc6 Mon Sep 17 00:00:00 2001 From: Marco Torres Morgado Date: Tue, 24 Feb 2026 16:57:29 +0000 Subject: [PATCH] ci: add release workflow for x86_64 builds --- .gitea/workflows/release.yml | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..6ef9e1a --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,55 @@ +name: Release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Zig + uses: mlugg/setup-zig@v2 + with: + version: 0.15.2 + + - name: Build + run: zig build -Doptimize=ReleaseSafe + + - name: Package binary + run: | + cd zig-out/bin + zip ../../zigfetch-x86_64-linux.zip zigfetch + cd ../.. + + - name: Create Release + env: + GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} + run: | + # Create release + RELEASE_RESPONSE=$(curl -s -X POST "https://gitea.bitua.io/api/v1/repos/bitua/zigfetch/releases" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\": \"${GITHUB_REF_NAME}\", \"name\": \"${GITHUB_REF_NAME}\"}") + + RELEASE_ID=$(echo "$RELEASE_RESPONSE" | jq -r .id) + + if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then + echo "Failed to create release: $RELEASE_RESPONSE" + exit 1 + fi + + echo "Created release with ID: $RELEASE_ID" + + # Upload asset + curl -s -X POST "https://gitea.bitua.io/api/v1/repos/bitua/zigfetch/releases/${RELEASE_ID}/assets?name=zigfetch-x86_64-linux.zip" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -F "attachment=@zigfetch-x86_64-linux.zip" +