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 Magisk/KernelSU Module | ||
on: | ||
push: | ||
tags: [ v*.*.* ] | ||
jobs: | ||
build: | ||
name: Build Module | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup Apt Dependencies | ||
run: | | ||
sudo apt update -y && sudo apt upgrade -y | ||
sudo apt install zip unzip jq -y | ||
- name: Make | ||
shell: bash | ||
run: | | ||
get_prop() { sed -n "s|^$1=||p" module.prop; } | ||
ID="$(get_prop id)" | ||
VERSION="$(get_prop version)" | ||
VERSIONCODE="$(get_prop versionCode)" | ||
zip -r "$ID-v$VERSION-($VERSIONCODE).zip" * -x ".git" -x "README.md" | ||
- name: Update | ||
shell: bash | ||
run: | | ||
get_prop() { sed -n "s|^$1=||p" module.prop; } | ||
ID="$(get_prop id)" | ||
VERSION="$(get_prop version)" | ||
VERSIONCODE="$(get_prop versionCode)" | ||
ZIPURL="https://github.com/LittleDipshit/AntiAMTS-Magisk/releases/download/v$VERSION/$ID-v$VERSION-($VERSIONCODE).zip" | ||
cat update.json | jq --arg vn $VERSION --arg vc $VERSIONCODE --arg zu $ZIPURL '. + {version: $vn, versionCode: $vc, zipUrl: $zu}' > update.json | ||
- name: Publish | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: *-v*-(*).zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Setup Git | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
- name: Commit Changes | ||
run: | | ||
git add . | ||
git commit -m "Update update.json" || true | ||
git push || true |