feat: add openWRT data fetch #6
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
name: Create Release on Tag | |
# on: [workflow_dispatch] | |
# on: | |
# push: | |
# tags: | |
# - "v*.*.*" | |
jobs: | |
build: | |
name: "v${{ matrix.build_env.tag }} - ${{ matrix.build_env.pkgarch}} :: ${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}} build" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
build_env: | |
- tag: "23.05.4" | |
pkgarch: aarch64_cortex-a53 | |
target: mediatek | |
subtarget: filogic | |
vermagic: "03ba5b5fee47f2232a088e3cd9832aec" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: openwrt/openwrt | |
ref: v${{ matrix.build_env.tag }} | |
fetch-depth: 0 | |
- name: Cache Tools and Kernel | |
id: cache-tools-kernel | |
uses: actions/cache@v4 | |
env: | |
cache-name: "cache-tools-kernel-${{ matrix.build_env.tag }}-${{ matrix.build_env.pkgarch}}-${{ matrix.build_env.target}}-${{ matrix.build_env.subtarget}}" | |
with: | |
path: "**" | |
key: ${{ runner.os }}-build-vm4-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-build-vm4-cache-tools-kernel-${{ matrix.build_env.tag }}-${{ matrix.build_env.pkgarch}}- | |
- name: Building kernel and tools | |
#if: ${{ steps.cache-tools-kernel.outputs.cache-hit != 'true' }} | |
run: | | |
echo "pkgarch: ${{ matrix.build_env.pkgarch}}, target:${{ matrix.build_env.target}}, subtarget: ${{ matrix.build_env.subtarget}}" | |
# Setup & install feeds | |
wget https://downloads.openwrt.org/releases/${{ matrix.build_env.tag }}/targets/${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}}/feeds.buildinfo -O feeds.conf | |
echo "src-git awgopenwrt https://github.com/yury-sannikov/awg-openwrt.git" >> ./feeds.conf | |
./scripts/feeds update && ./scripts/feeds install -a | |
# Setup config with AWG and dependencies | |
wget https://downloads.openwrt.org/releases/${{ matrix.build_env.tag }}/targets/${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}}/config.buildinfo -O .config | |
echo "CONFIG_PACKAGE_kmod-amneziawg=m" >> .config | |
echo "CONFIG_PACKAGE_amneziawg-tools=y" >> .config | |
echo "CONFIG_PACKAGE_luci-app-amneziawg=y" >> .config | |
echo "CONFIG_PACKAGE_kmod-crypto-lib-chacha20=m" >> .config | |
echo "CONFIG_PACKAGE_kmod-crypto-lib-chacha20poly1305=m" >> .config | |
echo "CONFIG_PACKAGE_kmod-crypto-chacha20poly1305=m" >> .config | |
make defconfig | |
echo " > make tools/install" | |
make tools/install -i -j `nproc` | |
cat ./build_dir/target-*/linux-*/linux-*/.vermagic || true | |
echo " > make toolchain/install" | |
make toolchain/install -i -j `nproc` | |
cat ./build_dir/target-*/linux-*/linux-*/.vermagic || true | |
# compile kernel module | |
echo " > make target/linux/compile" | |
make target/linux/compile -i -j `nproc` V=s | |
VERMAGIC=`cat ./build_dir/target-*/linux-*/linux-*/.vermagic` | |
VERMAGIC_EXPECTED=${{ matrix.build_env.vermagic }} | |
if [ "$VERMAGIC" != "$VERMAGIC_EXPECTED" ]; then | |
echo Vermagic mismatch: $VERMAGIC, expected $VERMAGIC_EXPECTED | |
exit 1 | |
fi | |
- name: Build AmneziaWG | |
run: | | |
VERMAGIC=`cat ./build_dir/target-*/linux-*/linux-*/.vermagic` | |
echo "Vermagic: $VERMAGIC" | |
VERMAGIC_EXPECTED=${{ matrix.build_env.vermagic }} | |
if [ "$VERMAGIC" != "$VERMAGIC_EXPECTED" ]; then | |
echo Vermagic mismatch: $VERMAGIC, expected $VERMAGIC_EXPECTED | |
exit 1 | |
fi | |
# Ignore kmod build for some targets, replace with the awg-go | |
make package/kmod-amneziawg/{clean,download,prepare} V=s || true | |
make package/kmod-amneziawg/compile V=s || true | |
make package/luci-app-amneziawg/{clean,download,prepare} | |
make package/luci-app-amneziawg/compile V=s | |
make V=s package/amneziawg-tools/{clean,download,prepare} | |
make V=s package/amneziawg-tools/compile | |
- name: Prepare artifacts | |
run: | | |
tag_name=${{ github.ref_name }} | |
mkdir -p awgrelease | |
postfix="${tag_name}_v${{ matrix.build_env.tag }}_${{ matrix.build_env.pkgarch}}_${{ matrix.build_env.target}}_${{ matrix.build_env.subtarget}}" | |
cp bin/packages/${{ matrix.build_env.pkgarch }}/awgopenwrt/amneziawg-tools_*.ipk awgrelease/amneziawg-tools_${postfix}.ipk | |
cp bin/packages/${{ matrix.build_env.pkgarch }}/awgopenwrt/luci-app-amneziawg_*.ipk awgrelease/luci-app-amneziawg_${postfix}.ipk | |
cp bin/targets/${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}}/packages/kmod-amneziawg_*.ipk awgrelease/kmod-amneziawg_${postfix}.ipk | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: awgrelease/*.ipk | |