From cb4fc2ac54195f1ffefc0fdba1a420731e22a196 Mon Sep 17 00:00:00 2001 From: Dhanus Date: Thu, 31 Oct 2024 14:43:34 +0530 Subject: [PATCH 01/12] ci: Add build for 32/64 bit images --- .github/workflows/release.yml | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..98347a86 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Build and publish RaspAP images + +permissions: + contents: write + +on: + release: + types: [published] + +jobs: + build-raspap-image: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - arch: "32-bit" + pi_gen_version: "master" + - arch: "64-bit" + pi_gen_version: "arm64" + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Update and install Git + run: | + sudo apt-get update + sudo apt-get install -y git + + - name: Build RaspAP Image + id: build + uses: usimd/pi-gen-action@v1 + with: + image-name: "raspap-${{ github.ref_name }}-${{ matrix.arch }}" + enable-ssh: 1 + stage-list: stage0 stage1 stage2 + verbose-output: true + pi-gen-version: ${{ matrix.pi_gen_version }} + + - name: Upload Artifact + uses: svenstaro/upload-release-action@v2 + with: + asset_name: raspap-image-${{ github.ref_name }}-${{ matrix.arch }} + file: ${{ steps.build.outputs.image-path }} + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref }} + overwrite: true From f1a5b9163bb5d558c6d8a45a6a3282935ef50d75 Mon Sep 17 00:00:00 2001 From: Dhanus Date: Thu, 31 Oct 2024 17:12:17 +0530 Subject: [PATCH 02/12] fix: asset_name file type --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 98347a86..b02fa62d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,7 @@ jobs: - name: Upload Artifact uses: svenstaro/upload-release-action@v2 with: - asset_name: raspap-image-${{ github.ref_name }}-${{ matrix.arch }} + asset_name: raspap-image-${{ github.ref_name }}-${{ matrix.arch }}.zip file: ${{ steps.build.outputs.image-path }} repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.ref }} From a1b0ade0a55f83afdb2bda565b6401983e632fcb Mon Sep 17 00:00:00 2001 From: Dhanus Date: Thu, 31 Oct 2024 17:15:18 +0530 Subject: [PATCH 03/12] chore: remove system update --- .github/workflows/release.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b02fa62d..f1d220c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,11 +21,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Update and install Git - run: | - sudo apt-get update - sudo apt-get install -y git - - name: Build RaspAP Image id: build uses: usimd/pi-gen-action@v1 From d90ccf4277369c5e5197f6f4851fc80e17a70b43 Mon Sep 17 00:00:00 2001 From: Dhanus Date: Thu, 31 Oct 2024 17:27:45 +0530 Subject: [PATCH 04/12] fix: upload img instead of zip --- .github/workflows/release.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1d220c0..b0be8e51 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,11 +31,16 @@ jobs: verbose-output: true pi-gen-version: ${{ matrix.pi_gen_version }} + - name: Unzip and Rename Image File + run: | + unzip ${{ steps.build.outputs.image-path }} -d extracted_image + mv "$(find extracted_image -name "*.img")" "raspap-image-${{ github.ref_name }}-${{ matrix.arch }}.img" + - name: Upload Artifact uses: svenstaro/upload-release-action@v2 with: - asset_name: raspap-image-${{ github.ref_name }}-${{ matrix.arch }}.zip - file: ${{ steps.build.outputs.image-path }} + file: raspap-image-${{ github.ref_name }}-${{ matrix.arch }}.img repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.ref }} overwrite: true + file_glob: true From 69d58f4713d5fe1a3f567c9988700ae3762ac182 Mon Sep 17 00:00:00 2001 From: Dhanus Date: Thu, 31 Oct 2024 17:56:18 +0530 Subject: [PATCH 05/12] chore: revert to previous commit due to extracted image size > 2GB This reverts commit a1b0ade0a55f83afdb2bda565b6401983e632fcb. --- .github/workflows/release.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0be8e51..f1d220c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,16 +31,11 @@ jobs: verbose-output: true pi-gen-version: ${{ matrix.pi_gen_version }} - - name: Unzip and Rename Image File - run: | - unzip ${{ steps.build.outputs.image-path }} -d extracted_image - mv "$(find extracted_image -name "*.img")" "raspap-image-${{ github.ref_name }}-${{ matrix.arch }}.img" - - name: Upload Artifact uses: svenstaro/upload-release-action@v2 with: - file: raspap-image-${{ github.ref_name }}-${{ matrix.arch }}.img + asset_name: raspap-image-${{ github.ref_name }}-${{ matrix.arch }}.zip + file: ${{ steps.build.outputs.image-path }} repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.ref }} overwrite: true - file_glob: true From 274b42d225cf80c73dfa955300154a81d4b54e11 Mon Sep 17 00:00:00 2001 From: Dhanus Date: Thu, 31 Oct 2024 18:20:25 +0530 Subject: [PATCH 06/12] chore: add custom stage --- .github/workflows/release.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1d220c0..76d5abe9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,13 +21,33 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Add Custom Stage + run: | + mkdir -p custom_stage_raspap/package-raspap && + { + cat > custom_stage_raspap/package-raspap/00-run-chroot.sh <<-EOF + #!/bin/bash + curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 + EOF + } && + chmod +x custom_stage_raspap/package-raspap/00-run-chroot.sh && + { + cat > custom_stage_raspap/prerun.sh <<-EOF + #!/bin/bash -e + if [ ! -d "\${ROOTFS_DIR}" ]; then + copy_previous + fi + EOF + } && + chmod +x custom_stage_raspap/prerun.sh + - name: Build RaspAP Image id: build uses: usimd/pi-gen-action@v1 with: image-name: "raspap-${{ github.ref_name }}-${{ matrix.arch }}" enable-ssh: 1 - stage-list: stage0 stage1 stage2 + stage-list: stage0 stage1 stage2 ./custom_stage_raspap verbose-output: true pi-gen-version: ${{ matrix.pi_gen_version }} From 710a8dab4e4fe6d2220d40713d35603cd49918ce Mon Sep 17 00:00:00 2001 From: Dhanus Date: Thu, 31 Oct 2024 18:28:26 +0530 Subject: [PATCH 07/12] chore: add curl installation --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76d5abe9..4083a1e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,7 @@ jobs: { cat > custom_stage_raspap/package-raspap/00-run-chroot.sh <<-EOF #!/bin/bash + apt-get install -y curl curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 EOF } && From 8048fcf5c45e669619e7a26eb6282b6c4cd20615 Mon Sep 17 00:00:00 2001 From: Dhanus Date: Thu, 31 Oct 2024 19:00:59 +0530 Subject: [PATCH 08/12] chore: add apt-get update --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4083a1e3..fe3980be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: { cat > custom_stage_raspap/package-raspap/00-run-chroot.sh <<-EOF #!/bin/bash - apt-get install -y curl + apt-get update -y && apt-get install -y curl curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 EOF } && From 28d1395bef4fef7b66328d55e43d83b273f5d168 Mon Sep 17 00:00:00 2001 From: Dhanus Date: Fri, 1 Nov 2024 12:17:55 +0530 Subject: [PATCH 09/12] chore: fail-fast false for 32 bit image build to finish --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe3980be..625c6027 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,7 @@ jobs: pi_gen_version: "master" - arch: "64-bit" pi_gen_version: "arm64" + fail-fast: false steps: - name: Checkout repository uses: actions/checkout@v4 From 90794c8828af98aefed839a14cb1bd207ea2cd5b Mon Sep 17 00:00:00 2001 From: Dhanus Date: Fri, 1 Nov 2024 18:08:34 +0530 Subject: [PATCH 10/12] fix: disable all options --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 625c6027..04092803 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: cat > custom_stage_raspap/package-raspap/00-run-chroot.sh <<-EOF #!/bin/bash apt-get update -y && apt-get install -y curl - curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 + curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 0 --restapi 0 --adblock 0 --wireguard 0 --tcp-bbr 0 EOF } && chmod +x custom_stage_raspap/package-raspap/00-run-chroot.sh && From 8ae468376f01216493eed6285c9d00a85208d550 Mon Sep 17 00:00:00 2001 From: Dhanus Date: Sat, 2 Nov 2024 22:19:01 +0530 Subject: [PATCH 11/12] fix: enable all flags and install missing packages --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04092803..d854d0bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,13 +26,13 @@ jobs: run: | mkdir -p custom_stage_raspap/package-raspap && { - cat > custom_stage_raspap/package-raspap/00-run-chroot.sh <<-EOF + cat > custom_stage_raspap/package-raspap/00-run.sh <<-EOF #!/bin/bash - apt-get update -y && apt-get install -y curl - curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 0 --restapi 0 --adblock 0 --wireguard 0 --tcp-bbr 0 + apt-get update -y && apt-get install -y curl iptables procps + curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 EOF } && - chmod +x custom_stage_raspap/package-raspap/00-run-chroot.sh && + chmod +x custom_stage_raspap/package-raspap/00-run.sh && { cat > custom_stage_raspap/prerun.sh <<-EOF #!/bin/bash -e From c1975a78a1d7fa122cde0e35f55921ef1608855f Mon Sep 17 00:00:00 2001 From: Dhanus Date: Mon, 4 Nov 2024 22:05:02 +0530 Subject: [PATCH 12/12] chore: Use pi-gen fork --- .github/workflows/release.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d854d0bd..4eac8c5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,26 +22,26 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Add Custom Stage + - name: Add RaspAP Stage run: | - mkdir -p custom_stage_raspap/package-raspap && + mkdir -p stage-raspap/package-raspap && { - cat > custom_stage_raspap/package-raspap/00-run.sh <<-EOF + cat > stage-raspap/package-raspap/00-run-chroot.sh <<-EOF #!/bin/bash - apt-get update -y && apt-get install -y curl iptables procps + apt-get update -y && apt-get install -y curl dhcpcd5 iptables procps curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 EOF } && - chmod +x custom_stage_raspap/package-raspap/00-run.sh && + chmod +x stage-raspap/package-raspap/00-run-chroot.sh && { - cat > custom_stage_raspap/prerun.sh <<-EOF + cat > stage-raspap/prerun.sh <<-EOF #!/bin/bash -e if [ ! -d "\${ROOTFS_DIR}" ]; then copy_previous fi EOF } && - chmod +x custom_stage_raspap/prerun.sh + chmod +x stage-raspap/prerun.sh - name: Build RaspAP Image id: build @@ -49,9 +49,10 @@ jobs: with: image-name: "raspap-${{ github.ref_name }}-${{ matrix.arch }}" enable-ssh: 1 - stage-list: stage0 stage1 stage2 ./custom_stage_raspap + stage-list: stage0 stage1 stage2 ./stage-raspap verbose-output: true pi-gen-version: ${{ matrix.pi_gen_version }} + pi-gen-repository: RaspAP/pi-gen - name: Upload Artifact uses: svenstaro/upload-release-action@v2