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). So this # workflow runs in parallel with release.yml and waits for the agent tarballs # before attaching packages. The `release: published` trigger stays for # manually published releases. on: push: tags: ['v*'] release: types: [published] 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/ gh release upload "$TAG" dist/packages/*.${{ matrix.format }} --clobber 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/ gh release upload "$TAG" dist/packages/*.${{ matrix.format }} --clobber 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__*.ipk (no colisiona con el tarball netpulse__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 gh release upload "$TAG" $files --clobber