From 0ccb27b1930ad5b5bda9640b4bb8046df91a495d Mon Sep 17 00:00:00 2001 From: kilyabin <65072190+kilyabin@users.noreply.github.com> Date: Thu, 30 Apr 2026 01:58:00 +0400 Subject: [PATCH] fix(ci): correct install deps and push release --- .gitea/workflows/build.yml | 61 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 4f79152..b9f77c7 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -4,6 +4,8 @@ on: push: branches: - '**' + tags: + - 'v*' jobs: build-backend: @@ -14,7 +16,9 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies - run: apk add --no-cache go gcc musl-dev libpcap-dev + run: | + sed -i 's|https://dl-cdn.alpinelinux.org|http://dl-cdn.alpinelinux.org|g' /etc/apk/repositories + apk add --no-cache go gcc musl-dev libpcap-dev - name: Download modules run: go mod download @@ -43,7 +47,10 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies - run: apk add --no-cache nodejs npm && npm install + run: | + sed -i 's|https://dl-cdn.alpinelinux.org|http://dl-cdn.alpinelinux.org|g' /etc/apk/repositories + apk add --no-cache nodejs npm + npm install - name: Build run: npm run generate @@ -57,3 +64,53 @@ jobs: - name: Clean up run: rm -rf .output/ + + release: + name: Create Release + runs-on: host-runner + needs: [build-backend, build-frontend] + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Install curl + run: | + sed -i 's|https://dl-cdn.alpinelinux.org|http://dl-cdn.alpinelinux.org|g' /etc/apk/repositories + apk add --no-cache curl + + - name: Download backend artifact + uses: actions/download-artifact@v4 + with: + name: ids-backend + path: release/ + + - name: Download frontend artifact + uses: actions/download-artifact@v4 + with: + name: ids-frontend + path: release/frontend/ + + - name: Pack frontend + run: tar -czf release/ids-frontend.tar.gz -C release/frontend . + + - name: Create release and upload assets + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + TAG="${{ github.ref_name }}" + REPO="${{ github.repository }}" + SERVER="${{ github.server_url }}" + + RELEASE_ID=$(curl -sf -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"${TAG}\",\"name\":\"Release ${TAG}\"}" \ + "${SERVER}/api/v1/repos/${REPO}/releases" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) + + curl -sf -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -F "attachment=@release/ids" \ + "${SERVER}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets" + + curl -sf -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -F "attachment=@release/ids-frontend.tar.gz" \ + "${SERVER}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets"