Release 11.2 #28
Workflow file for this run
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: Build Zapret Module | |
run-name: ${{ startsWith(github.ref, 'refs/tags/') && format('Release {0}', github.ref_name) || null }} | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '[0-9]+*' | |
jobs: | |
build-android: | |
name: Binary for Android ${{ matrix.abi }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- abi: armeabi-v7a | |
target: armv7a-linux-androideabi | |
- abi: arm64-v8a | |
target: aarch64-linux-android | |
- abi: x86 | |
target: i686-linux-android | |
- abi: x86_64 | |
target: x86_64-linux-android | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: bol-van/zapret | |
path: zapret | |
- name: Build | |
env: | |
ABI: ${{ matrix.abi }} | |
TARGET: ${{ matrix.target }} | |
run: | | |
DEPS_DIR=$GITHUB_WORKSPACE/deps | |
export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64 | |
export API=21 | |
export CC="$TOOLCHAIN/bin/clang --target=$TARGET$API" | |
export AR=$TOOLCHAIN/bin/llvm-ar | |
export AS=$CC | |
export LD=$TOOLCHAIN/bin/ld | |
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib | |
export STRIP=$TOOLCHAIN/bin/llvm-strip | |
export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig | |
# Download and build netfilter libs | |
wget -qO- https://www.netfilter.org/pub/libnfnetlink/libnfnetlink-1.0.2.tar.bz2 | tar -xj | |
wget -qO- https://www.netfilter.org/pub/libmnl/libmnl-1.0.5.tar.bz2 | tar -xj | |
wget -qO- https://www.netfilter.org/pub/libnetfilter_queue/libnetfilter_queue-1.0.5.tar.bz2 | tar -xj | |
wget -qO- https://raw.githubusercontent.com/bol-van/zapret/master/.github/workflows/libnetfilter_queue-android.patch | patch -p1 -d libnetfilter_queue-1.0.5 | |
for i in libmnl libnfnetlink libnetfilter_queue; do | |
( | |
cd $i-* | |
CFLAGS="-Os -flto=auto -Wno-implicit-function-declaration" \ | |
./configure --prefix= --host=$TARGET --enable-static --disable-shared --disable-dependency-tracking | |
make install -j$(nproc) DESTDIR=$DEPS_DIR | |
) | |
sed -i "s|^prefix=.*|prefix=$DEPS_DIR|g" $DEPS_DIR/lib/pkgconfig/$i.pc | |
done | |
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -I$DEPS_DIR/include" \ | |
LDFLAGS="-L$DEPS_DIR/lib" \ | |
make -C zapret android -j$(nproc) | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nfqws-${{ matrix.abi }} | |
path: zapret/binaries/my/nfqws | |
if-no-files-found: error | |
build-module: | |
name: Magisk Module | |
runs-on: ubuntu-latest | |
needs: build-android | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download nfqws armeabi-v7a | |
uses: actions/download-artifact@v4 | |
with: | |
name: nfqws-armeabi-v7a | |
path: module | |
- name: Rename nfqws to nfqws-arm | |
run: | | |
mv module/nfqws module/nfqws-arm | |
- name: Download nfqws arm64-v8a | |
uses: actions/download-artifact@v4 | |
with: | |
name: nfqws-arm64-v8a | |
path: module | |
- name: Rename nfqws to nfqws-aarch64 | |
run: | | |
mv module/nfqws module/nfqws-aarch64 | |
- name: Download nfqws x86 | |
uses: actions/download-artifact@v4 | |
with: | |
name: nfqws-x86 | |
path: module | |
- name: Rename nfqws to nfqws-x86 | |
run: | | |
mv module/nfqws module/nfqws-x86 | |
- name: Download nfqws x86_64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: nfqws-x86_64 | |
path: module | |
- name: Rename nfqws to nfqws-x86_x64 | |
run: | | |
mv module/nfqws module/nfqws-x86_x64 | |
- name: Build Magisk Module | |
run: | | |
version=${{ github.ref_name }} | |
version_code=$(echo "${version}" | sed 's/[^0-9]//g') | |
echo "version=${version}" >> $GITHUB_ENV | |
echo "versionCode=${version_code}" >> $GITHUB_ENV | |
echo version=${version} | |
echo versionCode=${version_code} | |
sudo apt update | |
sudo apt install -y p7zip-full | |
cd module | |
echo "id=zapret" > module.prop | |
echo "name=zapret For Magisk" >> module.prop | |
echo "version=${version}" >> module.prop | |
echo "versionCode=${version_code}" >> module.prop | |
echo "author=sevcator, bol-van, ImMALWARE, Fenrir-0xFF, Flowseal" >> module.prop | |
echo "description=π‘ Bypass internet-censorship via DPI modification" >> module.prop | |
echo "updateJson=https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/main/update.json" >> module.prop | |
for file in ./*.sh; do | |
[ -f "$file" ] && sed -i -e '$a\' "$file" | |
done | |
cd .. | |
7z a zapret-Magisk.zip ./module/* | |
- name: Set up Git | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "github-actions@github.com" | |
- name: Push update.json | |
run: | | |
echo '{ | |
"version": "${{ env.version }}", | |
"versionCode": "${{ env.versionCode }}", | |
"zipUrl": "https://github.com/${{ github.repository }}/releases/download/${{ env.version }}/zapret-Magisk.zip", | |
"changelog": "https://raw.githubusercontent.com/${{ github.repository }}/main/CHANGELOG.md" | |
}' > new_update.json | |
if [[ -f update.json ]]; then | |
if cmp -s update.json new_update.json; then | |
echo "No changes to update.json. Skipping commit." | |
exit 0 | |
fi | |
fi | |
mv new_update.json update.json | |
git add update.json | |
git commit -m "Release ${{ env.version }}" | |
git push origin HEAD:main --force | |
- name: Calculate SHA-256 checksum | |
id: sha256 | |
run: echo "SHA256=$(sha256sum zapret-Magisk.zip | awk '{ print $1 }')" >> $GITHUB_ENV | |
- name: Upload Module Zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zapret-Magisk | |
path: zapret-Magisk.zip | |
if-no-files-found: error | |
- name: Upload release assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
fail_on_unmatched_files: true | |
prerelease: false | |
draft: false | |
body: | | |
π Please report problems on [GitHub issues](https://github.com/${{ github.repository }}/issues) or [directly me](https://sevcator.github.io/) | |
π SHA256: ${{ env.SHA256 }} | |
files: | | |
zapret-Magisk.zip |