18 Commits

Author SHA1 Message Date
datadunia eb525879f1 fix: test build
Beta Release / deploy (push) Successful in 1m2s
2026-05-09 15:19:03 +07:00
datadunia b1c7f10fec fix: test build
Beta Release / deploy (push) Successful in 1m4s
2026-05-09 14:41:26 +07:00
datadunia da09fb2e65 fix: test build
Beta Release / deploy (push) Successful in 1m3s
2026-05-09 14:34:26 +07:00
datadunia fefaf49298 fix: test build
Beta Release / deploy (push) Successful in 1m1s
2026-05-09 13:50:03 +07:00
datadunia fc05ac0725 fix: test build
Beta Release / deploy (push) Failing after 20s
2026-05-09 05:54:28 +07:00
datadunia 5bcac141d1 fix: test build
Beta Release / deploy (push) Successful in 1m4s
2026-05-09 03:48:48 +07:00
datadunia c7ad30d2df fix: test build
Beta Release / deploy (push) Successful in 1m4s
2026-05-09 02:42:52 +07:00
datadunia 93f6aaea76 feat: check and delete existing release before creating a new one
Beta Release / deploy (push) Successful in 1m5s
2026-05-09 01:57:11 +07:00
datadunia 7a448ffa3a fix: test build
Beta Release / deploy (push) Successful in 58s
2026-05-09 01:47:14 +07:00
datadunia 89443f9481 fix: test build
Beta Release / deploy (push) Successful in 49s
2026-05-09 01:27:45 +07:00
datadunia c5d3651a96 fix: test build
Beta Release / deploy (push) Failing after 1m0s
2026-05-09 01:22:33 +07:00
datadunia 548e3949ad feat: test build
Beta Release / deploy (push) Failing after 35s
2026-05-09 01:00:59 +07:00
datadunia 4b8d5008d6 refactor: extract shared CI steps to deploy_call.yaml reusable workflow
Beta Release / deploy (push) Successful in 50s
Release / deploy (push) Successful in 59s
2026-05-08 05:51:48 +07:00
datadunia 25e0cfd15e refactor: extract shared CI steps to deploy_call.yaml reusable workflow
Release / deploy (push) Has been cancelled
Beta Release / deploy (push) Has been cancelled
2026-05-08 05:48:02 +07:00
datadunia 9c771f098c refactor: extract shared CI steps to deploy_call.yaml reusable workflow
Beta Release / deploy (push) Successful in 59s
Release / deploy (push) Failing after 56s
2026-05-08 05:41:06 +07:00
datadunia dfc8d9ed57 fix: restore Create Release step with correct Swagger-compliant JSON and auth header
Release / build-and-release (push) Successful in 1m0s
2026-05-08 05:04:54 +07:00
datadunia 565d7f1a35 fix: restore Create Release step with correct Swagger-compliant JSON and auth header
Release / build-and-release (push) Failing after 54s
2026-05-08 05:00:55 +07:00
datadunia 45c7788d1d fix: restore Create Release step with correct Swagger-compliant JSON and auth header
Release / build-and-release (push) Failing after 52s
2026-05-08 04:55:29 +07:00
5 changed files with 183 additions and 130 deletions
+15
View File
@@ -0,0 +1,15 @@
name: Beta Release
on:
push:
tags:
- 'v*-beta*'
- 'v*-test*'
jobs:
deploy:
if: "contains(github.ref_name, 'beta') || contains(github.ref_name, 'test')"
uses: ./.gitea/workflows/deploy_call.yaml
with:
prerelease: true
secrets: inherit
+136
View File
@@ -0,0 +1,136 @@
name: Deploy
on:
workflow_call:
inputs:
prerelease:
description: 'Mark as prerelease'
required: false
type: boolean
default: false
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Clone repository with submodules
run: |
git config --global --remove-section http || true
git config --global --unset-all core.askPass || true
TOKEN="${{ secrets.BUILD_TOKEN }}"
git clone --recurse-submodules \
-c credential.helper="" \
https://token:$TOKEN@git.datadunia.com/devops/wireguard-vpn.git .
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build Vue frontend
run: |
cd app/frontend
npm install
npm run build
- name: Build Go binaries
run: |
cd app
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ../wgrplane-linux-amd64 .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ../wgrplane-linux-arm64 .
- name: Generate latest.json
run: |
VERSION="${{ gitea.ref_name }}"
RELEASE_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
REPO="${{ gitea.repository }}"
SERVER="${{ gitea.server_url }}"
cat > latest.json << ENDJSON
{
"version": "$VERSION",
"release_date": "$RELEASE_DATE",
"download_urls": {
"amd64": "${SERVER}/${REPO}/releases/download/${VERSION}/wgrplane-linux-amd64",
"arm64": "${SERVER}/${REPO}/releases/download/${VERSION}/wgrplane-linux-arm64"
}
}
ENDJSON
- name: Create Release and upload assets
env:
TOKEN: ${{ secrets.BUILD_TOKEN }}
run: |
if [ -z "$TOKEN" ]; then
echo "Value: [EMPTY]"
exit 1
else
echo "Length: ${#TOKEN} characters"
fi
REPO="${{ gitea.repository }}"
TAG="${{ gitea.ref_name }}"
API="${{ gitea.server_url }}/api/v1"
# 0. Check & Delete Existing Release
echo "=== 0. Check & Delete Existing Release ==="
EXISTING_RESP=$(curl -s -H "Authorization: token $TOKEN" "$API/repos/$REPO/releases/tags/$TAG")
EXISTING_ID=$(echo "$EXISTING_RESP" | grep -o '"id":[0-9]*' | head -n 1 | cut -d':' -f2 || true)
if [ -n "$EXISTING_ID" ] && [ "$EXISTING_ID" != "null" ]; then
echo "⚠️ Found existing release for tag $TAG with ID: $EXISTING_ID. Deleting..."
DELETE_RESP=$(curl -s -w "\n%{http_code}" -X DELETE -H "Authorization: token $TOKEN" "$API/repos/$REPO/releases/$EXISTING_ID")
echo "✅ Delete response: $DELETE_RESP"
else
echo "No existing release found for $TAG. Proceeding..."
fi
# 1. Create Release
echo "=== 1. Create New Release ==="
JSON_BODY=$(printf '{"tag_name":"%s","name":"%s","body":"Release %s","draft":false,"prerelease":%s}' "$TAG" "$TAG" "$TAG" "${{ inputs.prerelease }}")
RELEASE_RESP=$(curl -s -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON_BODY" \
"$API/repos/$REPO/releases")
# Ambil ID dengan lebih teliti
# Tambahkan || true agar grep tidak membuat script crash (karena set -e) jika id tidak ditemukan
RELEASE_ID=$(echo "$RELEASE_RESP" | grep -o '"id":[0-9]*' | head -n 1 | cut -d':' -f2 || true)
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
echo "Gagal membuat release. Response: $RELEASE_RESP"
exit 1
fi
echo "Release ID: $RELEASE_ID"
# 2. Upload Assets
for FILE in wgrplane-linux-amd64 wgrplane-linux-arm64 latest.json; do
if [ -f "$FILE" ]; then
echo "Uploading $FILE..."
curl -s -X POST \
-H "Authorization: token $TOKEN" \
-F "attachment=@$FILE" \
"$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$FILE"
else
echo "Skip $FILE (tidak ditemukan)"
fi
done
- name: Cleanup build artifacts
if: always()
run: |
git config --global --remove-section http || true
git config --global --unset-all core.askPass || true
rm -f wgrplane-linux-amd64 wgrplane-linux-arm64 latest.json
rm -rf app/frontend/node_modules app/frontend/dist
echo "Cleanup done"
+7 -122
View File
@@ -3,127 +3,12 @@ name: Release
on: on:
push: push:
tags: tags:
- 'v*' - 'v[0-9]*.[0-9]*.[0-9]'
permissions:
contents: write
jobs: jobs:
build-and-release: deploy:
runs-on: ubuntu-latest if: "!contains(github.ref_name, 'beta') && !contains(github.ref_name, 'test')"
steps: uses: ./.gitea/workflows/deploy_call.yaml
- name: Clone repository with submodules with:
run: | prerelease: false
git config --global --remove-section http || true secrets: inherit
git config --global --unset-all core.askPass || true
TOKEN="${{ secrets.TOKEN_BUILD }}"
git clone --recurse-submodules \
-c credential.helper="" \
https://token:$TOKEN@git.datadunia.com/devops/wireguard-vpn.git .
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build Vue frontend
run: |
cd app/frontend
npm install
npm run build
- name: Build Go binaries
run: |
cd app
GOOS=linux GOARCH=amd64 go build -o ../wgrplane-linux-amd64 .
GOOS=linux GOARCH=arm64 go build -o ../wgrplane-linux-arm64 .
- name: Generate latest.json
run: |
VERSION="${{ gitea.ref_name }}"
RELEASE_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
REPO="${{ gitea.repository }}"
SERVER="${{ gitea.server_url }}"
cat > latest.json << ENDJSON
{
"version": "$VERSION",
"release_date": "$RELEASE_DATE",
"download_urls": {
"amd64": "${SERVER}/${REPO}/releases/download/${VERSION}/wgrplane-linux-amd64",
"arm64": "${SERVER}/${REPO}/releases/download/${VERSION}/wgrplane-linux-arm64"
}
}
ENDJSON
- name: Create Release and upload assets
env:
TOKEN: ${{ secrets.TOKEN_BUILD }} # <--- Tambahkan ini
run: |
if [ -z "$TOKEN" ]; then
echo "❌ ERROR: Secret TOKEN_BUILD tidak terbaca oleh runner!"
exit 1
else
echo "✅ Secret terbaca (panjang karakter: ${#TOKEN})"
fi
# # Gunakan variabel bawaan Gitea Actions untuk keandalan
# REPO="${{ gitea.repository }}"
# TAG="${{ gitea.ref_name }}"
# API="${{ gitea.server_url }}/api/v1"
# echo "Menciptakan release untuk tag: $TAG"
# # 1. Create Release
# # Menggunakan -w "%{http_code}" untuk debugging jika gagal
# JSON_BODY=$(printf '{"tag_name":"%s","name":"%s","body":"Release %s","draft":false,"prerelease":false}' "$TAG" "$TAG" "$TAG")
# RELEASE_RESP=$(curl -s -X POST \
# -H "Authorization: token $TOKEN" \
# -H "Content-Type: application/json" \
# -d "$JSON_BODY" \
# "$API/repos/$REPO/releases")
# # Cara lebih aman ambil ID (menghapus "id": dan tanda koma)
# RELEASE_ID=$(echo "$RELEASE_RESP" | grep -o '"id":[0-9]*' | cut -d':' -f2)
# if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
# echo "Gagal membuat release. Response: $RELEASE_RESP"
# exit 1
# fi
# echo "Release berhasil dibuat dengan ID: $RELEASE_ID"
# # 2. Upload 3 File menggunakan loop
# # Sesuai Swagger: POST /repos/{owner}/{repo}/releases/{id}/assets
# for FILE in wgrplane-linux-amd64 wgrplane-linux-arm64 latest.json; do
# if [ -f "$FILE" ]; then
# echo "Sedang mengupload: $FILE..."
# UPLOAD_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
# -H "Authorization: token $TOKEN" \
# -F "attachment=@$FILE" \
# "$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$FILE")
# if [ "$UPLOAD_STATUS" == "201" ]; then
# echo "Berhasil upload $FILE"
# else
# echo "Gagal upload $FILE (HTTP Status: $UPLOAD_STATUS)"
# exit 1
# fi
# else
# echo "Error: File $FILE tidak ditemukan di direktori!"
# exit 1
# fi
# done
- name: Cleanup build artifacts
if: always()
run: |
git config --global --remove-section http || true
git config --global --unset-all core.askPass || true
rm -f wgrplane-linux-amd64 wgrplane-linux-arm64 latest.json
rm -rf app/frontend/node_modules app/frontend/dist
echo "Cleanup done"
+24 -7
View File
@@ -355,19 +355,36 @@ cd ../..
# Server starts on :10087 # Server starts on :10087
``` ```
### Option 4: Systemd Service ### Option 4: Native CLI / Systemd Service
The WGRplane binary includes a built-in CLI to manage its own systemd service.
```bash ```bash
# Install service file # Check system dependencies first
sudo cp wgrplane.service /etc/systemd/system/ ./wgrplane doctor
sudo systemctl daemon-reload
sudo systemctl enable wgrplane.service # Install as systemd service (auto-creates unit, enables, and starts)
sudo systemctl start wgrplane.service sudo ./wgrplane install
# View logs # View logs
journalctl -u wgrplane.service -f journalctl -u wgrplane -f
# Other available commands:
sudo ./wgrplane stop
sudo ./wgrplane restart
sudo ./wgrplane uninstall
``` ```
### Manual Serve & Config
To run the server manually in the foreground with custom ports:
```bash
./wgrplane serve --port 8080 --host 127.0.0.1
```
On first run, it generates a default configuration file at `~/.config/wgrplane/config.json`.
--- ---
## 📁 Project Structure ## 📁 Project Structure
+1 -1
Submodule app updated: 57ffe45ab7...b43866d42c