diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..b1b7bca --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,100 @@ +# Git(tea) Actions workflow: Build and publish standalone binaries +# ──────────────────────────────────────────────────────────────────── +# ✧ Builds the Go‑based WoL server for +# • linux/amd64 → wol-server-linux-amd64.tar.gz +# • windows/amd64 → wol-server-windows-amd64.zip +# ✧ Attaches the archives as workflow artifacts **and** to a tag‑based release +# (vX.Y.Z). If the push is to main (without tag), the artifacts are still +# available in the workflow run. +# +# Prerequisites (⇔ repository secrets / variables): +# • GITEA_TOKEN – API token with repo write permissions (for release upload) +# (not needed if your Gitea instance auto‑authenticates Actions) +# ──────────────────────────────────────────────────────────────────── + +name: build‑binaries + +on: + push: + branches: [ "main" ] + tags: [ "v*" ] + +jobs: + build: + runs-on: ubuntu-fast + + strategy: + matrix: + include: + - goos: linux # ➜ .tar.gz + ext: "" + - goos: windows # ➜ .zip (adds .exe) + ext: ".exe" + + env: + GO_VERSION: "1.22" + BINARY_NAME: wol-server + + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + cache: true + + - name: Build ${{ matrix.goos }}/amd64 + shell: bash + run: | + mkdir -p dist + GOOS=${{ matrix.goos }} GOARCH=amd64 go build -trimpath -ldflags "-s -w" \ + -o "dist/${BINARY_NAME}-${{ matrix.goos }}-amd64${{ matrix.ext }}" . + + - name: Package archive + shell: bash + run: | + cd dist + if [ "${{ matrix.goos }}" == "windows" ]; then + zip "${BINARY_NAME}-windows-amd64.zip" "${BINARY_NAME}-windows-amd64.exe" + rm "${BINARY_NAME}-windows-amd64.exe" + else + tar -czf "${BINARY_NAME}-linux-amd64.tar.gz" "${BINARY_NAME}-linux-amd64" + rm "${BINARY_NAME}-linux-amd64" + fi + + - name: Upload workflow artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.goos }}-amd64 + path: | + dist/*.zip + dist/*.tar.gz + + # Optional: publish release assets if this is a tag push + release: + if: startsWith(github.ref, 'refs/tags/') + needs: build + runs-on: ubuntu-fast + permissions: + contents: write + + steps: + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + path: ./dist + + - name: Create / Update release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN || github.token }} + with: + name: "Release ${{ github.ref_name }}" + tag_name: ${{ github.ref_name }} + draft: false + prerelease: false + files: | + dist/**/wol-server-*.zip + dist/**/wol-server-*.tar.gz diff --git a/compose.yml b/compose.yml index 880a36f..9df7165 100644 --- a/compose.yml +++ b/compose.yml @@ -2,31 +2,35 @@ services: api: image: git.send.nrw/sendnrw/edge-wol:latest container_name: edgewol + restart: unless-stopped volumes: - /docker/edgewol/machines.json:/data/machines.json - labels: - - traefik.enable=true - - traefik.http.routers.edgewol.rule=Host(`edgewol.b1tsblog.org`) - - traefik.http.services.edgewol.loadbalancer.server.port=8080 - - traefik.http.routers.edgewol.entrypoints=websecure - - traefik.http.routers.edgewol.tls=true - - traefik.http.routers.edgewol.tls.certresolver=letsencrypt - - traefik.http.middlewares.edgewol-redirect.redirectscheme.scheme=https - - traefik.http.middlewares.edgewol-redirect.redirectscheme.permanent=true - - traefik.http.routers.edgewol0.rule=Host(`edgewol.b1tsblog.org`) - - traefik.http.routers.edgewol0.entrypoints=web - - traefik.http.routers.edgewol0.middlewares=edgewol-redirect - - traefik.protocol=http - networks: - - traefik-net + #labels: + #- traefik.enable=true + #- traefik.http.routers.edgewol.rule=Host(`edgewol.b1tsblog.org`) + #- traefik.http.services.edgewol.loadbalancer.server.port=8080 + #- traefik.http.routers.edgewol.entrypoints=websecure + #- traefik.http.routers.edgewol.tls=true + #- traefik.http.routers.edgewol.tls.certresolver=letsencrypt + #- traefik.http.middlewares.edgewol-redirect.redirectscheme.scheme=https + #- traefik.http.middlewares.edgewol-redirect.redirectscheme.permanent=true + #- traefik.http.routers.edgewol0.rule=Host(`edgewol.b1tsblog.org`) + #- traefik.http.routers.edgewol0.entrypoints=web + #- traefik.http.routers.edgewol0.middlewares=edgewol-redirect + #- traefik.protocol=http + network_mode: host + #networks: + #- traefik-net environment: # HIER BEARBEITEN EW_USERNAME: groot EW_PASSWORD: "" EW_PRODUCTIVE: true + EW_DB: /data/machines.json + TZ: Europe/Berlin # Sollten Ports extern verfügbar gemacht werden müssen (nicht empfohlen) - #ports: - #- "8080:8080" # : + ports: + - "8080:8080" # : restart: unless-stopped # Newt-Client für eine Pangolin-Integration #newt: