From 481807769e82600e05598406b84ef3f3151206a6 Mon Sep 17 00:00:00 2001 From: datadunia Date: Wed, 6 May 2026 05:27:58 +0700 Subject: [PATCH] feat: add Gitea CI/CD workflows and update documentation - Add .gitea/workflows/release.yaml for multi-arch build (amd64, arm64) - Generate latest.json for auto-update system - Update AGENTS.md and README.md for WGRplane integration - Update app/ submodule reference to latest commit (2db8e5a) --- .gitea/workflows/release.yaml | 104 ++++++++++++++++++++++++++++++++++ app | 2 +- 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/release.yaml diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..b59dd8a --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,104 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + actions: read + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + goarch: [amd64, arm64] + steps: + - name: Checkout code + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 + + - name: Setup Go + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff + with: + go-version: '1.22' + + - name: Setup Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + with: + node-version: '20' + + - name: Build Vue frontend + run: | + cd app/frontend + npm install + npm run build + + - name: Build Go binary + env: + GOOS: linux + GOARCH: ${{ matrix.goarch }} + run: | + cd app + go build -o ../wgrplane-linux-${{ matrix.goarch }} . + + - name: Upload binary artifact + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + with: + name: wgrplane-linux-${{ matrix.goarch }} + path: wgrplane-linux-${{ matrix.goarch }} + + generate-latest-json: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 + + - name: Download all artifacts + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 + with: + path: artifacts + + - name: Generate latest.json + run: | + VERSION="${{ gitea.ref_name }}" + if [ -z "$VERSION" ]; then + VERSION="$(git rev-parse --short HEAD)" + fi + RELEASE_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" + # Get changelog: commits since last tag, or last 10 commits + CHANGELOG="$(git log --oneline --no-merges $(git describe --tags --abbrev=0 2>/dev/null || echo 'HEAD~10')..HEAD 2>/dev/null || git log --oneline --no-merges -10)" + # Generate latest.json + cat > latest.json << EOF + { + "version": "$VERSION", + "release_date": "$RELEASE_DATE", + "changelog": $(echo "$CHANGELOG" | jq -R -s '.'), + "download_urls": { + "amd64": "${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}/artifacts/$(curl -s -H 'Authorization: Bearer ${{ gitea.token }}' '${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}/artifacts' | jq -r '.data[] | select(.name == "wgrplane-linux-amd64") | .id')", + "arm64": "${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}/artifacts/$(curl -s -H 'Authorization: Bearer ${{ gitea.token }}' '${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}/artifacts' | jq -r '.data[] | select(.name == "wgrplane-linux-arm64") | .id')" + } + } + EOF + + - name: Checkout main branch + run: | + git fetch origin main + git checkout main + + - name: Commit and push latest.json + run: | + git config user.name "Gitea Actions" + git config user.email "actions@gitea.com" + git remote set-url origin "https://${{ gitea.actor }}:${{ gitea.token }}@${{ gitea.server_url }}/${{ gitea.repository }}.git" + git add latest.json + git commit -m "Update latest.json for release ${{ gitea.ref_name }} [skip ci]" || echo "No changes to commit" + git push origin main + + - name: Upload latest.json artifact + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + with: + name: latest.json + path: latest.json diff --git a/app b/app index ff80d9c..2db8e5a 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit ff80d9c4628f83540e9d94bf2842b8d8e05a6cd3 +Subproject commit 2db8e5a0f64bb286473f18b962bda8da74efa4cb