Skip to content

Build

Build #138

Workflow file for this run

name: Build
on:
schedule:
- cron: "0 9/12 * * *"
workflow_dispatch:
push:
branches: ["main", "ci"]
paths:
- ".github/workflows/build_android.yml"
- "patches/**"
permissions:
contents: write
jobs:
check_version:
runs-on: ubuntu-22.04
outputs:
FRIDA_VERSION: ${{ steps.pullFridaLatestRelease.outputs.FRIDA_VERSION }}
ALREADY_RELEASE: ${{ steps.checkReleaseVersion.outputs.ALREADY_RELEASE }}
steps:
- name: Pull Frida Latest Release
id: pullFridaLatestRelease
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const releaseResponse = await github.repos.getLatestRelease({
owner: 'frida',
repo: 'frida',
})
const { data: { tag_name: ver } } = releaseResponse;
core.setOutput('FRIDA_VERSION', ver);
- name: Split Repository Name
id: split_name
run: |
repo_name=${{ github.repository }}
IFS='/' read -ra repo_parts <<< "$repo_name"
echo "owner=${repo_parts[0]}" >> $GITHUB_OUTPUT
echo "repo=${repo_parts[1]}" >> $GITHUB_OUTPUT
- name: Check release version
id: checkReleaseVersion
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
try {
const releaseVersion = '${{ steps.pullFridaLatestRelease.outputs.FRIDA_VERSION }}'
const releaseResponse = await github.repos.getReleaseByTag({
owner: '${{ steps.split_name.outputs.owner }}',
repo: '${{ steps.split_name.outputs.repo }}',
tag: releaseVersion
});
const { data: { tag_name: ver } } = releaseResponse;
if (ver == '${{ steps.pullFridaLatestRelease.outputs.FRIDA_VERSION }}'){
if ( ${{ ( github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}){
core.setOutput('ALREADY_RELEASE', '2');
} else {
core.setOutput('ALREADY_RELEASE', '1');
}
} else {
core.setOutput('ALREADY_RELEASE', '0');
}
} catch (e) {
if (e.message == 'Not Found') {
core.setOutput('ALREADY_RELEASE', '0');
} else {
core.setFailed(e.message);
}
}
- name: Delete release
if: ${{ steps.checkReleaseVersion.outputs.ALREADY_RELEASE == '2' }}
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
tag_name: ${{ steps.pullFridaLatestRelease.outputs.FRIDA_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true
create_release:
needs: check_version
runs-on: ubuntu-22.04
if: needs.check_version.outputs.ALREADY_RELEASE != '1'
steps:
- uses: actions/create-release@master
id: createRelease
name: Create Runner Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ needs.check_version.outputs.FRIDA_VERSION }}"
release_name: "${{ needs.check_version.outputs.FRIDA_VERSION }}"
prerelease: false
android_build:
runs-on: ubuntu-22.04
needs: [check_version, create_release]
steps:
- uses: actions/checkout@v3
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Setup Android NDK r25
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r25b
- name: Clone Frida repository with submodules
run: |
git clone --recurse-submodules https://github.com/frida/frida
cd frida
git submodule update --init --recursive
- name: Apply patches to frida-core
shell: bash
run: |
if [ -d "frida/subprojects/frida-core" ]; then
cd frida/subprojects/frida-core
for patch in ${{ github.workspace }}/patches/frida-core/*.patch; do
git am "$patch"
done
else
echo "Directory frida/subprojects/frida-core does not exist"
exit 1
fi
- name: Build frida for Android
shell: bash
run: |
ARCHES="android-arm android-arm64 android-x86 android-x86_64"
export ANDROID_NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }}
for ARCH in $ARCHES
do
mkdir build-$ARCH
cd build-$ARCH
../frida/configure --host=$ARCH
make || { echo "Build failed for $ARCH"; exit 1; }
mv subprojects/frida-core/server/frida-server subprojects/frida-core/server/SherlockElf-server
mv subprojects/frida-core/inject/frida-inject subprojects/frida-core/inject/SherlockElf-inject
mv subprojects/frida-core/lib/gadget/frida-gadget.so subprojects/frida-core/lib/gadget/SherlockElf-gadget.so
cd ..
done
- name: Split Repository Name
id: split_name
run: |
repo_name=${{ github.repository }}
IFS='/' read -ra repo_parts <<< "$repo_name"
echo "owner=${repo_parts[0]}" >> $GITHUB_OUTPUT
echo "repo=${repo_parts[1]}" >> $GITHUB_OUTPUT
- name: Check release version
id: checkReleaseVersion
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
try {
const releaseVersion = '${{ needs.check_version.outputs.FRIDA_VERSION }}'
const releaseResponse = await github.repos.getReleaseByTag({
owner: '${{ steps.split_name.outputs.owner }}',
repo: '${{ steps.split_name.outputs.repo }}',
tag: releaseVersion
})
const { data: { id: releaseId, html_url: htmlUrl, upload_url: uploadUrl } } = releaseResponse;
core.setOutput('id', releaseId);
core.setOutput('html_url', htmlUrl);
core.setOutput('upload_url', uploadUrl);
core.setOutput('version', releaseVersion);
} catch (e) {
core.setFailed(e.message);
}
- name: Package build result for Android
shell: bash
run: |
gzip build-android-arm/subprojects/frida-core/server/SherlockElf-server
gzip build-android-arm64/subprojects/frida-core/server/SherlockElf-server
gzip build-android-x86/subprojects/frida-core/server/SherlockElf-server
gzip build-android-x86_64/subprojects/frida-core/server/SherlockElf-server
gzip build-android-arm/subprojects/frida-core/inject/SherlockElf-inject
gzip build-android-arm64/subprojects/frida-core/inject/SherlockElf-inject
gzip build-android-x86/subprojects/frida-core/inject/SherlockElf-inject
gzip build-android-x86_64/subprojects/frida-core/inject/SherlockElf-inject
gzip build-android-arm/subprojects/frida-core/lib/gadget/SherlockElf-gadget.so
gzip build-android-arm64/subprojects/frida-core/lib/gadget/SherlockElf-gadget.so
gzip build-android-x86/subprojects/frida-core/lib/gadget/SherlockElf-gadget.so
gzip build-android-x86_64/subprojects/frida-core/lib/gadget/SherlockElf-gadget.so
- name: Upload android arm SherlockElf-server
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-arm/subprojects/frida-core/server/SherlockElf-server.gz
asset_name: SherlockElf-server-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-arm.gz
asset_content_type: application/octet-stream
- name: Upload android arm64 SherlockElf-server
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-arm64/subprojects/frida-core/server/SherlockElf-server.gz
asset_name: SherlockElf-server-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-arm64.gz
asset_content_type: application/octet-stream
- name: Upload android x86 SherlockElf-server
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-x86/subprojects/frida-core/server/SherlockElf-server.gz
asset_name: SherlockElf-server-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-x86.gz
asset_content_type: application/octet-stream
- name: Upload android x86_64 SherlockElf-server
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-x86_64/subprojects/frida-core/server/SherlockElf-server.gz
asset_name: SherlockElf-server-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-x86_64.gz
asset_content_type: application/octet-stream
- name: Upload android arm SherlockElf-inject
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-arm/subprojects/frida-core/inject/SherlockElf-inject.gz
asset_name: SherlockElf-inject-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-arm.gz
asset_content_type: application/octet-stream
- name: Upload android arm64 SherlockElf-inject
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-arm64/subprojects/frida-core/inject/SherlockElf-inject.gz
asset_name: SherlockElf-inject-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-arm64.gz
asset_content_type: application/octet-stream
- name: Upload android x86 SherlockElf-inject
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-x86/subprojects/frida-core/inject/SherlockElf-inject.gz
asset_name: SherlockElf-inject-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-x86.gz
asset_content_type: application/octet-stream
- name: Upload android x86_64 SherlockElf-inject
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-x86_64/subprojects/frida-core/inject/SherlockElf-inject.gz
asset_name: SherlockElf-inject-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-x86_64.gz
asset_content_type: application/octet-stream
- name: Upload android arm SherlockElf-gadget
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-arm/subprojects/frida-core/lib/gadget/SherlockElf-gadget.so.gz
asset_name: SherlockElf-gadget-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-arm.so.gz
asset_content_type: application/octet-stream
- name: Upload android arm64 SherlockElf-gadget
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-arm64/subprojects/frida-core/lib/gadget/SherlockElf-gadget.so.gz
asset_name: SherlockElf-gadget-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-arm64.so.gz
asset_content_type: application/octet-stream
- name: Upload android x86 SherlockElf-gadget
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-x86/subprojects/frida-core/lib/gadget/SherlockElf-gadget.so.gz
asset_name: SherlockElf-gadget-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-x86.so.gz
asset_content_type: application/octet-stream
- name: Upload android x86_64 SherlockElf-gadget
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.checkReleaseVersion.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build-android-x86_64/subprojects/frida-core/lib/gadget/SherlockElf-gadget.so.gz
asset_name: SherlockElf-gadget-${{ needs.check_version.outputs.FRIDA_VERSION }}-android-x86_64.so.gz
asset_content_type: application/octet-stream