ci: add release workflow for x86_64 builds
Some checks failed
Release / build (push) Failing after 19s
Some checks failed
Release / build (push) Failing after 19s
This commit is contained in:
55
.gitea/workflows/release.yml
Normal file
55
.gitea/workflows/release.yml
Normal file
@@ -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"
|
||||||
|
|
||||||
Reference in New Issue
Block a user