CI: Update to Ghidra 10.4 #92
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: Java CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
GHIDRA_VERSION: 10.4.0 | |
GHIDRA_DATE: 20230928 | |
jobs: | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Set up Ghidra | |
run: | | |
set -x | |
curl -L -O "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${GHIDRA_VERSION}_build/ghidra_${GHIDRA_VERSION}_PUBLIC_${GHIDRA_DATE}.zip" | |
unzip -q "ghidra_${GHIDRA_VERSION}_PUBLIC_${GHIDRA_DATE}.zip" | |
echo "GHIDRA_INSTALL_DIR=${PWD}/ghidra_${GHIDRA_VERSION}_PUBLIC" >> $GITHUB_ENV | |
working-directory: /tmp | |
- name: Build with Gradle | |
run: ./gradlew | |
- name: Upload to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libefidecompress.dylib | |
path: os/mac_x86_64/libefidecompress.dylib | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Set up Ghidra | |
run: | | |
Invoke-WebRequest "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${env:GHIDRA_VERSION}_build/ghidra_${env:GHIDRA_VERSION}_PUBLIC_${env:GHIDRA_DATE}.zip" -OutFile "ghidra_${env:GHIDRA_VERSION}_PUBLIC_${env:GHIDRA_DATE}.zip" | |
Expand-Archive "ghidra_${env:GHIDRA_VERSION}_PUBLIC_${env:GHIDRA_DATE}.zip" -DestinationPath . | |
echo "GHIDRA_INSTALL_DIR=$pwd\ghidra_${env:GHIDRA_VERSION}_PUBLIC" >> ${env:GITHUB_ENV} | |
working-directory: ${{ env.TEMP }} | |
- name: Build with Gradle | |
run: ./gradlew.bat | |
- name: Upload to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: efidecompress.dll | |
path: os/win_x86_64/efidecompress.dll | |
build-linux: | |
needs: [build-macos, build-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Set up Ghidra | |
run: | | |
set -x | |
curl -L -O "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${GHIDRA_VERSION}_build/ghidra_${GHIDRA_VERSION}_PUBLIC_${GHIDRA_DATE}.zip" | |
unzip -q "ghidra_${GHIDRA_VERSION}_PUBLIC_${GHIDRA_DATE}.zip" | |
echo "GHIDRA_INSTALL_DIR=${PWD}/ghidra_${GHIDRA_VERSION}_PUBLIC" >> $GITHUB_ENV | |
working-directory: /tmp | |
- name: Download macOS JNI library | |
uses: actions/download-artifact@v3 | |
with: | |
name: libefidecompress.dylib | |
path: os/mac_x86_64 | |
- name: Download Windows JNI library | |
uses: actions/download-artifact@v3 | |
with: | |
name: efidecompress.dll | |
path: os/win_x86_64 | |
- name: Build plugin with Gradle | |
run: | | |
set -x | |
./gradlew | |
plugin_date=$(find dist -name '*.zip' | awk -F '_' '{print $4}') | |
last_tag=$(git tag -l "$plugin_date.*" | sort -n | tail -n 1) | |
if [ ! -z "$last_tag" ]; then | |
plugin_tag=$(echo "$last_tag" | awk -F '.' '{print $1 "." $2+1}') | |
else | |
plugin_tag="$plugin_date.0" | |
last_tag=$(git tag -l | sort -n | tail -n 1) | |
if [ -z "$last_tag" ]; then | |
last_tag=$(git rev-list --max-parents=0 HEAD) | |
fi | |
fi | |
plugin_changelog="$(git log --pretty=format:%s ${last_tag}.. | sed -e 's/^/- /')" | |
echo "PLUGIN_TAG=${plugin_tag}" >> $GITHUB_ENV | |
echo "PLUGIN_CHANGELOG<<EOF" >> $GITHUB_ENV | |
echo "$plugin_changelog" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
mv dist/*.zip "dist/ghidra_${GHIDRA_VERSION}_PUBLIC_${plugin_tag}_ghidra-firmware-utils.zip" | |
- name: Upload to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.zip | |
- name: Upload to Releases | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/*.zip | |
tag: ${{ env.PLUGIN_TAG }} | |
file_glob: true | |
body: ${{ env.PLUGIN_CHANGELOG }} |