(testing1) friWrt Firmware #76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#===================================================================================== | |
# Description: Build OpenWrt and ImmortalWrt with Image Builder | |
# Instructions: https://openwrt.org/docs/guide-user/additional-software/imagebuilder | |
# Download from: https://downloads.openwrt.org/releases | |
# https://downloads.immortalwrt.org/releases | |
#===================================================================================== | |
name: (testing1) friWrt Firmware | |
on: | |
workflow_dispatch: | |
inputs: | |
target: | |
description: "Select device target:" | |
required: true | |
default: "Raspberry Pi 4B" | |
type: choice | |
options: | |
- all | |
- Raspberry Pi 3B | |
- Raspberry Pi 4B | |
- NanoPi-R5S | |
- x86-64 | |
release_branch: | |
description: "Select the release branch:" | |
required: true | |
default: "openwrt:23.05.2" | |
type: choice | |
options: | |
- openwrt:snapshots | |
- openwrt:21.02.7 | |
- openwrt:23.05.2 | |
- immortalwrt:snapshots | |
- immortalwrt:21.02.7 | |
- immortalwrt:23.05.1 | |
tunnel: | |
description: "Select VPN Client app (!passwall only support for newer branch with fw4 firewall!):" | |
required: true | |
default: "all" | |
type: choice | |
options: | |
- all | |
- openclash | |
- passwall | |
- openclash-passwall | |
- no-tunnel | |
clean: | |
description: "Do 'make clean' for each run" | |
required: false | |
default: "true" | |
type: boolean | |
squashfs: | |
description: "Generate squashfs image" | |
required: false | |
default: "true" | |
type: boolean | |
upload-artifacts: | |
description: "Upload compiled image to Artifacts only" | |
required: false | |
default: "false" | |
type: boolean | |
env: | |
RELEASE_BRANCH: ${{ inputs.release_branch }} | |
ROOTFS_SQUASHFS: ${{ inputs.squashfs }} | |
TUNNEL: ${{ inputs.tunnel }} | |
CLEAN: ${{ inputs.clean }} | |
TZ: Asia/Jakarta | |
jobs: | |
prebuild: | |
runs-on: ubuntu-latest | |
name: ${{ inputs.release_branch }} | |
outputs: | |
target: ${{ steps.set-matrix.outputs.target }} | |
steps: | |
- id: set-matrix | |
run: | | |
if [ "${{ inputs.target }}" == "all" ]; then | |
echo "target=['Raspberry Pi 3B','Raspberry Pi 4B','x86-64']" >> $GITHUB_OUTPUT | |
else | |
echo "target=['${{ inputs.target }}']" >> $GITHUB_OUTPUT | |
fi | |
Generate: | |
needs: prebuild | |
runs-on: ubuntu-latest | |
name: "${{ matrix.target }}; ${{ inputs.tunnel }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ${{fromJSON(needs.prebuild.outputs.target)}} | |
steps: | |
- name: Initialization System Environment | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -qq install build-essential libncurses5-dev libncursesw5-dev zlib1g-dev gawk git gettext libssl-dev xsltproc rsync wget unzip tar gzip qemu-utils mkisofs | |
sudo timedatectl set-timezone "$TZ" | |
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV | |
- name: Setup Environment Variables | |
run: | | |
if [ "$TARGET" == "Raspberry Pi 3B" ]; then | |
echo "PROFILE=rpi-3" >> $GITHUB_ENV | |
echo "TARGET_SYSTEM=bcm27xx/bcm2710" >> $GITHUB_ENV | |
echo "TARGET_NAME=bcm27xx-bcm2710" >> $GITHUB_ENV | |
echo "ARCH_1=armv7" >> $GITHUB_ENV | |
echo "ARCH_2=aarch64" >> $GITHUB_ENV | |
echo "ARCH_3=aarch64_cortex-a53" >> $GITHUB_ENV | |
elif [ "$TARGET" == "Raspberry Pi 4B" ]; then | |
echo "PROFILE=rpi-4" >> $GITHUB_ENV | |
echo "TARGET_SYSTEM=bcm27xx/bcm2711" >> $GITHUB_ENV | |
echo "TARGET_NAME=bcm27xx-bcm2711" >> $GITHUB_ENV | |
echo "ARCH_1=arm64" >> $GITHUB_ENV | |
echo "ARCH_2=aarch64" >> $GITHUB_ENV | |
echo "ARCH_3=aarch64_cortex-a72" >> $GITHUB_ENV | |
elif [ "$TARGET" == "NanoPi-R5S" ]; then | |
echo "PROFILE=friendlyarm_nanopi-r5s" >> $GITHUB_ENV | |
echo "TARGET_SYSTEM=rockchip/armv8" >> $GITHUB_ENV | |
echo "TARGET_NAME=rockchip-armv8" >> $GITHUB_ENV | |
echo "ARCH_1=armv8" >> $GITHUB_ENV | |
echo "ARCH_2=aarch64" >> $GITHUB_ENV | |
echo "ARCH_3=aarch64_generic" >> $GITHUB_ENV | |
elif [ "$TARGET" == "x86-64" ]; then | |
echo "PROFILE=generic" >> $GITHUB_ENV | |
echo "TARGET_SYSTEM=x86/64" >> $GITHUB_ENV | |
echo "TARGET_NAME=x86-64" >> $GITHUB_ENV | |
echo "ARCH_1=amd64" >> $GITHUB_ENV | |
echo "ARCH_2=x86_64" >> $GITHUB_ENV | |
echo "ARCH_3=x86_64" >> $GITHUB_ENV | |
fi | |
echo "WORKING_DIR="${RELEASE_BRANCH%:*}"-imagebuilder-"$TARGET_NAME".Linux-x86_64" >> $GITHUB_ENV | |
echo "DOWNLOAD_BASE=https://downloads."${RELEASE_BRANCH%:*}".org" >> $GITHUB_ENV | |
echo "BASE=${RELEASE_BRANCH%:*}" >> $GITHUB_ENV | |
echo "BRANCH=${RELEASE_BRANCH#*:}" >> $GITHUB_ENV | |
echo "tags=$( [[ "${RELEASE_BRANCH#*:}" == "21.02.7" ]] && echo "21.02" )" >> $GITHUB_ENV | |
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
echo "DATETIME=$(date +'%Y.%m.%d-%H:%M:%S')" >> $GITHUB_ENV | |
echo "DATEMONTH=$(date +"%B-%Y" | awk '{print tolower($0)}')" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: origin | |
- name: Download Image Builder | |
id: download | |
run: | | |
SNAPSHOTS="$DOWNLOAD_BASE/$BRANCH/targets/$TARGET_SYSTEM/$BASE-imagebuilder-$TARGET_NAME.Linux-x86_64.tar.xz" | |
RELEASE="$DOWNLOAD_BASE/releases/$BRANCH/targets/$TARGET_SYSTEM/$BASE-imagebuilder-$BRANCH-$TARGET_NAME.Linux-x86_64.tar.xz" | |
[ "$BRANCH" == "snapshots" ] && wget -nv "$SNAPSHOTS" || wget -nv "$RELEASE" | |
tar -xJf *-imagebuilder-* && sync && rm -f *-imagebuilder-*.tar.xz && mv *-imagebuilder-* $WORKING_DIR && sync | |
cp -r $GITHUB_WORKSPACE/origin/* $GITHUB_WORKSPACE/$WORKING_DIR | |
echo "status=success" >> $GITHUB_OUTPUT | |
- name: Download External Packages | |
id: packages | |
if: steps.download.outputs.status == 'success' && !cancelled() | |
run: | | |
cd $WORKING_DIR | |
bash external-package-urls.sh | |
[ "$ARCH_1" == "amd64" ] && ARCH_1=x86 | |
if [[ "$BRANCH" == "21.02.7" ]]; then | |
grep -E "^all-all|^old-$tags|^$ARCH_1-$tags|^$ARCH_1" external-package-urls.txt | awk '{print $2}' > output_url.txt | |
else | |
grep -E "^all-all|^all|^$ARCH_1" external-package-urls.txt | grep -vE "^$ARCH_1-$tags" | awk '{print $2}' > output_url.txt | |
fi | |
wget --no-check-certificate -i output_url.txt -nv -P packages | |
echo "status=success" >> $GITHUB_OUTPUT | |
- name: Run Patch and DIY Scripts | |
id: scripts | |
if: steps.packages.outputs.status == 'success' && !cancelled() | |
run: | | |
cd $WORKING_DIR | |
bash scripts/builder-patch.sh | |
bash scripts/agh-core.sh | |
bash scripts/misc.sh | |
if [[ "$TUNNEL" == "all" && "$BRANCH" != "21.02.7" ]]; then | |
echo "VPN Client: $TUNNEL" | |
bash scripts/tunnel_app.sh openclash-passwall | |
elif [[ ("$TUNNEL" == "passwall" || "$TUNNEL" == "openclash-passwall") && "$BRANCH" != "21.02.7" || "$TUNNEL" == "openclash" ]]; then | |
echo "VPN Client: $TUNNEL" | |
bash scripts/tunnel_app.sh "$TUNNEL" | |
elif [[ "$TUNNEL" == "all" && "$BRANCH" = "21.02.7" ]]; then | |
echo "VPN Client: $TUNNEL" | |
bash scripts/tunnel_app.sh openclash | |
else | |
echo "No VPN Client selected" | |
fi | |
if [ "$TUNNEL" = "openclash" ] || [ "$TUNNEL" = "openclash-passwall" ] || [ "$TUNNEL" = "all" ]; then bash scripts/clash-core.sh; fi | |
ls packages | |
echo "status=success" >> $GITHUB_OUTPUT | |
echo -e "Server space usage before starting to compile: \n$(df -hT ${PWD}) \n" | |
- name: Compile Firmware | |
id: compile | |
if: steps.scripts.outputs.status == 'success' && !cancelled() | |
run: | | |
cd $WORKING_DIR | |
mkdir -p compiled_images | |
if [[ "$TUNNEL" == "all" && "$BRANCH" != "21.02.7" ]]; then | |
for t in openclash-passwall openclash passwall no-tunnel; do | |
echo "Compiling with VPN Client: $t" | |
if [ "$CLEAN" == "true" ]; echo "Start 'make clean' before building images."; then make clean; fi | |
time bash make-build.sh $PROFILE $t | |
rm -rf bin/targets/"$TARGET_SYSTEM"/*.{json,manifest,bin,*-rootfs*,*factory*,sha256sums} | |
for file in bin/targets/"$TARGET_SYSTEM"/*-"$TARGET_NAME"-*.img.gz; do mv "$file" compiled_images/fri_$(basename "$file" .img.gz)$( echo "_$t" )_$DATE.img.gz; done | |
done | |
elif [[ "$TUNNEL" == "all" && "$BRANCH" = "21.02.7" ]]; then | |
for t in openclash no-tunnel; do | |
echo "Compiling with VPN Client: $t" | |
if [ "$CLEAN" == "true" ]; echo "Start 'make clean' before building images."; then make clean; fi | |
time bash make-build.sh $PROFILE $t | |
rm -rf bin/targets/"$TARGET_SYSTEM"/*.{json,manifest,bin,*-rootfs*,*factory*,sha256sums} | |
for file in bin/targets/"$TARGET_SYSTEM"/*-"$TARGET_NAME"-*.img.gz; do mv "$file" compiled_images/fri_$(basename "$file" .img.gz)$( echo "_$t" )_$DATE.img.gz; done | |
done | |
elif [[ ("$TUNNEL" == "passwall" || "$TUNNEL" == "openclash-passwall") && "$BRANCH" != "21.02.7" || "$TUNNEL" == "openclash" || "$TUNNEL" == "no-tunnel" ]]; then | |
echo "Compiling with VPN Client: $TUNNEL" | |
bash make-build.sh $PROFILE $TUNNEL | |
rm -rf bin/targets/"$TARGET_SYSTEM"/*.{json,manifest,bin,*-rootfs*,*factory*,sha256sums} | |
for file in bin/targets/"$TARGET_SYSTEM"/*-"$TARGET_NAME"-*.img.gz; do mv "$file" compiled_images/fri_$(basename "$file" .img.gz)$( echo "_$TUNNEL" )_$DATE.img.gz; done | |
fi | |
sha256sum compiled_images/fri_*.img.gz > compiled_images/sha256sums | |
ls compiled_images | |
echo "status=success" >> $GITHUB_OUTPUT | |
echo -e "Server space usage after compilation: \n$(df -hT ${PWD}) \n" | |
- name: Upload All Firmware to Artifacts | |
if: github.event.inputs.upload-artifacts == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROFILE }}-${{ env.BASE }}-${{ env.BRANCH }}-${{ env.DATEMONTH }} | |
path: ${{ env.WORKING_DIR }}/compiled_images//* | |
- name: Upload Firmware to Release | |
uses: termux/upload-release-action@v4.0.2 | |
if: github.event.inputs.upload-artifacts == 'false' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file_glob: true | |
file: ${{ env.WORKING_DIR }}/compiled_images//* | |
asset_name: ${{ github.event.repository.name }}-${{ github.sha }} | |
tag: ${{ env.PROFILE }}-${{ env.BASE }}-${{ env.BRANCH }}-${{ env.DATEMONTH }} | |
overwrite: true | |
prerelease: true | |
body: | | |
### friWrt ${{ env.BASE }}-${{ env.BRANCH }} Image information | |
Build date: ${{ env.DATETIME }} | |
See [here](https://github.com/frizkyiman/friWrt-MyWrtBuilder?tab=readme-ov-file#firmware-details) for more detail feature and other information. | |
- Default IP: 192.168.1.1 | |
- Default username: root | |
- Default password: friwrt | |
- Default WIFI name: friWrt_2g | friWrt_5g (if device supported) | |
- Default WIFI password: friwrt2023 (if device supported) |