| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- name: openwrt-package
- # Builds the OpenWrt packages for the released agent and attaches them to the
- # published release:
- # - netpulse-agent as .ipk (24.10 SDK, mediatek/filogic) and .apk (25.12
- # SDK, armsr/armv8 -> aarch64_generic, instalable en aarch64 genérico y
- # en cortex-a53, cubriendo routers fuera de cortex-a53). Also built for
- # x86/64 (amd64 binary) since #672.
- # - luci-app-netpulse (arch all) as .ipk and .apk (#236).
- # - netpulse on-box server as .ipk and .apk (#364), also for x86/64 (#672).
- #
- # Triggered on v* tag pushes, the SAME event that runs release.yml. It does
- # not rely on the `release` event for goreleaser-published releases: goreleaser
- # creates releases with the workflow GITHUB_TOKEN, and events triggered by the
- # GITHUB_TOKEN do not start new workflow runs
- # (https://docs.github.com/en/actions/concepts/security/github_token). Publishing
- # a draft release creates its tag, so that flow also lands here through the push
- # event, and there is no `release: published` trigger on purpose: it fired a
- # second run of this same job for the same tag, and the two raced on the asset
- # name (#2197).
- on:
- push:
- tags: ['v*']
- workflow_dispatch:
- inputs:
- version:
- description: 'Release tag (ej: v2.6.0)'
- required: true
- permissions:
- contents: write
- jobs:
- package-agent:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- include:
- - sdk-version: 24.10.5
- sdk-target: mediatek/filogic
- format: ipk
- goarch: arm64
- - sdk-version: 25.12.5
- sdk-target: armsr/armv8
- format: apk
- goarch: arm64
- - sdk-version: 24.10.5
- sdk-target: x86/64
- format: ipk
- goarch: amd64
- - sdk-version: 25.12.5
- sdk-target: x86/64
- format: apk
- goarch: amd64
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- - name: Resolve release tag
- id: tag
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- echo "tag=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
- elif [ "${{ github.event_name }}" = "push" ]; then
- echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
- else
- echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
- fi
- - name: Wait for agent tarballs on the release
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- for i in $(seq 1 80); do
- assets="$(gh release view "$TAG" --json assets --jq '.assets[].name' 2>/dev/null || true)"
- if printf '%s\n' "$assets" | grep -q "netpulse-agent_.*_linux_${{ matrix.goarch }}.tar.gz" \
- && printf '%s\n' "$assets" | grep -qx 'checksums.txt'; then
- echo "Agent tarballs and checksums present after $i attempts"
- exit 0
- fi
- echo "Waiting for agent tarballs and checksums ($i/80)..."
- sleep 15
- done
- echo "ERROR: agent tarballs or checksums not found on $TAG after 20 min" >&2
- exit 1
- - name: Download netpulse-agent ${{ matrix.goarch }} binary
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- gh release download "$TAG" -p "netpulse-agent_*_linux_${{ matrix.goarch }}.tar.gz" -p checksums.txt --dir /tmp/agent
- cd /tmp/agent
- asset="$(ls netpulse-agent_*_linux_${{ matrix.goarch }}.tar.gz)"
- awk -v n="$asset" '{candidate=$NF; sub(/^\*/, "", candidate); if (candidate == n) print}' checksums.txt > agent-checksums.txt
- test -s agent-checksums.txt
- sha256sum -c agent-checksums.txt
- tar xzf "$asset"
- ls -la netpulse-agent
- file netpulse-agent
- - name: Package ${{ matrix.format }} (SDK ${{ matrix.sdk-version }})
- env:
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- chmod +x deploy/openwrt/package.sh
- export PKG_VERSION="${TAG#v}"
- export PKG_RELEASE="1"
- deploy/openwrt/package.sh \
- "${{ matrix.sdk-version }}" \
- "${{ matrix.sdk-target }}" \
- "" \
- "${{ matrix.format }}" \
- /tmp/agent/netpulse-agent
- - name: Upload to release
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- echo "Packages generated:"
- ls -la dist/packages/
- existing="$(gh release view "$TAG" --json assets --jq '.assets[].name' || true)"
- missing=()
- for f in dist/packages/*.${{ matrix.format }}; do
- if grep -qxF "$(basename "$f")" <<<"$existing"; then
- echo "already attached, skipping: $(basename "$f")"
- else
- missing+=("$f")
- fi
- done
- if [ ${#missing[@]} -gt 0 ]; then
- gh release upload "$TAG" "${missing[@]}" --clobber
- else
- echo "all package assets already attached"
- fi
- package-luci:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- include:
- - sdk-version: 24.10.5
- sdk-target: mediatek/filogic
- format: ipk
- - sdk-version: 25.12.5
- sdk-target: qualcommax/ipq807x
- format: apk
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- - name: Resolve release tag
- id: tag
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- echo "tag=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
- elif [ "${{ github.event_name }}" = "push" ]; then
- echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
- else
- echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
- fi
- - name: Wait for agent tarballs on the release
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- for i in $(seq 1 80); do
- if gh release view "$TAG" --json assets --jq '.assets[].name' 2>/dev/null | grep -q 'netpulse-agent_.*_linux_arm64.tar.gz'; then
- echo "Release ready after $i attempts"
- exit 0
- fi
- echo "Waiting for release assets ($i/80)..."
- sleep 15
- done
- echo "ERROR: agent tarballs not found on $TAG after 20 min" >&2
- exit 1
- - name: Package luci-app-netpulse ${{ matrix.format }} (SDK ${{ matrix.sdk-version }})
- env:
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- chmod +x deploy/openwrt/package-luci.sh
- export PKG_VERSION="${TAG#v}"
- export PKG_RELEASE="1"
- deploy/openwrt/package-luci.sh \
- "${{ matrix.sdk-version }}" \
- "${{ matrix.sdk-target }}" \
- "" \
- "${{ matrix.format }}"
- - name: Upload to release
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- echo "LuCI packages generated:"
- ls -la dist/packages/
- existing="$(gh release view "$TAG" --json assets --jq '.assets[].name' || true)"
- missing=()
- for f in dist/packages/*.${{ matrix.format }}; do
- if grep -qxF "$(basename "$f")" <<<"$existing"; then
- echo "already attached, skipping: $(basename "$f")"
- else
- missing+=("$f")
- fi
- done
- if [ ${#missing[@]} -gt 0 ]; then
- gh release upload "$TAG" "${missing[@]}" --clobber
- else
- echo "all LuCI assets already attached"
- fi
- package-server:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- include:
- - sdk-version: 24.10.5
- sdk-target: mediatek/filogic
- format: ipk
- goarch: arm64
- - sdk-version: 25.12.5
- sdk-target: armsr/armv8
- format: apk
- goarch: arm64
- - sdk-version: 24.10.5
- sdk-target: x86/64
- format: ipk
- goarch: amd64
- - sdk-version: 25.12.5
- sdk-target: x86/64
- format: apk
- goarch: amd64
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- - name: Resolve release tag
- id: tag
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- echo "tag=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
- elif [ "${{ github.event_name }}" = "push" ]; then
- echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
- else
- echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
- fi
- - name: Wait for server tarball on the release
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- for i in $(seq 1 80); do
- assets="$(gh release view "$TAG" --json assets --jq '.assets[].name' 2>/dev/null || true)"
- if printf '%s\n' "$assets" | grep -q "netpulse_.*_linux_${{ matrix.goarch }}.tar.gz" \
- && printf '%s\n' "$assets" | grep -qx 'checksums.txt'; then
- echo "Server tarball and checksums present after $i attempts"
- exit 0
- fi
- echo "Waiting for server tarball and checksums ($i/80)..."
- sleep 15
- done
- echo "ERROR: server tarball or checksums not found on $TAG after 20 min" >&2
- exit 1
- - name: Download netpulse server ${{ matrix.goarch }} binary
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- gh release download "$TAG" -p "netpulse_*_linux_${{ matrix.goarch }}.tar.gz" -p checksums.txt --dir /tmp/server
- cd /tmp/server
- asset="$(ls netpulse_*_linux_${{ matrix.goarch }}.tar.gz)"
- awk -v n="$asset" '{candidate=$NF; sub(/^\*/, "", candidate); if (candidate == n) print}' checksums.txt > server-checksums.txt
- test -s server-checksums.txt
- sha256sum -c server-checksums.txt
- tar xzf "$asset"
- ls -la netpulse
- file netpulse
- - name: Package ${{ matrix.format }} (SDK ${{ matrix.sdk-version }})
- env:
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- chmod +x deploy/openwrt/package-server.sh
- export PKG_VERSION="${TAG#v}"
- export PKG_RELEASE="1"
- deploy/openwrt/package-server.sh \
- "${{ matrix.sdk-version }}" \
- "${{ matrix.sdk-target }}" \
- "" \
- "${{ matrix.format }}" \
- /tmp/server/netpulse
- - name: Upload to release
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAG: ${{ steps.tag.outputs.tag }}
- run: |
- echo "Server packages generated:"
- ls -la dist/packages/
- # netpulse_<v>_*.ipk (no colisiona con el tarball netpulse_<v>_linux_*)
- files=$(ls dist/packages/netpulse[-_]*.${{ matrix.format }} 2>/dev/null || true)
- if [ -z "$files" ]; then
- echo "ERROR: no server package produced" >&2
- exit 1
- fi
- existing="$(gh release view "$TAG" --json assets --jq '.assets[].name' || true)"
- missing=()
- for f in $files; do
- if grep -qxF "$(basename "$f")" <<<"$existing"; then
- echo "already attached, skipping: $(basename "$f")"
- else
- missing+=("$f")
- fi
- done
- if [ ${#missing[@]} -gt 0 ]; then
- gh release upload "$TAG" "${missing[@]}" --clobber
- else
- echo "all server package assets already attached"
- fi
|