diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3dd69d0..a93e2f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,14 +12,23 @@ jobs: runs-on: ubuntu-latest steps: + # -------------------------------------------------- + # Checkout + # -------------------------------------------------- - name: Checkout code uses: actions/checkout@v4 + # -------------------------------------------------- + # Go setup + # -------------------------------------------------- - name: Set up Go uses: actions/setup-go@v5 with: go-version: "1.22" + # -------------------------------------------------- + # Build binaries + # -------------------------------------------------- - name: Build for ARMv6 (Pi Zero / Pi 1) run: | GOOS=linux GOARCH=arm GOARM=6 \ @@ -30,6 +39,9 @@ jobs: GOOS=linux GOARCH=arm64 \ go build -ldflags="-s -w" -o wol-server-arm64 + # -------------------------------------------------- + # systemd service (portable, no hardcoded user) + # -------------------------------------------------- - name: Create systemd service file run: | cat > wol-server.service << 'EOF' @@ -49,6 +61,9 @@ jobs: WantedBy=multi-user.target EOF + # -------------------------------------------------- + # Install script (auto-detect architecture) + # -------------------------------------------------- - name: Create install script run: | cat > install.sh << 'EOF' @@ -103,6 +118,9 @@ jobs: chmod +x install.sh + # -------------------------------------------------- + # Package + # -------------------------------------------------- - name: Create release package run: | mkdir -p package @@ -114,25 +132,16 @@ jobs: tar -czf wol-server.tar.gz -C package . - - name: Create Forgejo Release + # -------------------------------------------------- + # GitHub Release + # -------------------------------------------------- + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 if: github.ref == 'refs/heads/main' - run: | - TAG="v${{ github.run_number }}" - API_URL="${{ github.server_url }}/api/v1" - REPO="${{ github.repository }}" - - # Create release - RELEASE_ID=$(curl -s -X POST \ - -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ - -H "Content-Type: application/json" \ - "${API_URL}/repos/${REPO}/releases" \ - -d "{\"tag_name\": \"${TAG}\", \"name\": \"Release ${TAG}\", \"draft\": false, \"prerelease\": false}" \ - | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) - - # Upload asset - curl -s -X POST \ - -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ - "${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=wol-server.tar.gz" \ - -F "attachment=@wol-server.tar.gz" > /dev/null - - echo "Release ${TAG} created with asset wol-server.tar.gz" + with: + tag_name: v${{ github.run_number }} + name: Release v${{ github.run_number }} + files: | + wol-server.tar.gz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}