Update lint.yml #8
This file contains hidden or 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: CI-Build and Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
check_frida_update: | |
name: Check for Frida Updates | |
if: github.event_name == 'schedule' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install jq | |
run: sudo apt-get update -qq && sudo apt-get install -qq jq | |
- name: Check for new Frida version | |
id: update_check | |
run: | | |
CURRENT_VERSION=$(grep "fridaVersion =" module.gradle | awk -F"'" '{print $2}') | |
echo "Current Frida version: $CURRENT_VERSION" | |
LATEST_VERSION=$(curl -s https://api.github.com/repos/frida/frida/releases/latest | jq -r .tag_name) | |
echo "Latest Frida version: $LATEST_VERSION" | |
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then | |
echo "New Frida version found: $LATEST_VERSION. Updating file..." | |
sed -i "s/fridaVersion = '$CURRENT_VERSION'/fridaVersion = '$LATEST_VERSION'/" module.gradle | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add module.gradle | |
git commit -m "chore: Update Frida to version $LATEST_VERSION" | |
git push | |
else | |
echo "Frida is up-to-date." | |
fi | |
build: | |
name: Build Module | |
needs: check_frida_update | |
if: always() | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.module-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 11 | |
cache: gradle | |
- name: Test Build | |
run: | | |
chmod +x ./gradlew | |
./gradlew :module:assembleRelease | |
- name: Get Module Version | |
id: module-version | |
run: | | |
MODULE_VERSION=$(cat module.gradle | grep "moduleVersion =" | awk -F'"' '{print $2}') | |
echo "version=$MODULE_VERSION" >> "$GITHUB_OUTPUT" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ZygiskFrida-release | |
path: out/magisk_module_zygisk_release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ZygiskFrida-riru-release | |
path: out/magisk_module_riru_release | |
release: | |
name: Create Release | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
steps: | |
- name: Download Zygisk artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ZygiskFrida-release | |
path: zygisk-module | |
- name: Download Riru artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ZygiskFrida-riru-release | |
path: riru-module | |
- name: Get module version | |
id: get_version | |
run: echo "version=${{ needs.build.outputs.version }}" >> $GITHUB_OUTPUT | |
# --- ĐÂY LÀ BƯỚC ĐÃ ĐƯỢC SỬA LỖI --- | |
- name: Zip the artifacts correctly | |
run: | | |
# Di chuyển vào thư mục zygisk-module và nén nội dung bên trong nó | |
(cd zygisk-module && zip -r ../ZygiskFrida-${{ steps.get_version.outputs.version }}.zip .) | |
# Di chuyển vào thư mục riru-module và nén nội dung bên trong nó | |
(cd riru-module && zip -r ../ZygiskFrida-riru-${{ steps.get_version.outputs.version }}.zip .) | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
ZygiskFrida-${{ steps.get_version.outputs.version }}.zip | |
ZygiskFrida-riru-${{ steps.get_version.outputs.version }}.zip | |
tag_name: v${{ steps.get_version.outputs.version }} | |
name: Module v${{ steps.get_version.outputs.version }} | |
body: | | |
Auto-generated release for version ${{ steps.get_version.outputs.version }}. | |
- Zygisk Module | |
- Riru Module | |