Skip to content

Minor improvements

Minor improvements #32

Workflow file for this run

name: release
on:
release:
types: [published]
# Required for updating published release contents
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
# Root directory for doing Ghidra work (building, etc.)
root: ["/tmp/ghidra"]
# Repository name ("reait-ghidra")
name: ["${{github.event.repository.name}}"]
# Ghidra build version(s)
version: [11.1.2]
include:
- version: 11.1.2
release_url: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.1.2_build"
filename: "ghidra_11.1.2_PUBLIC_20240709.zip"
directory: "ghidra_11.1.2_PUBLIC"
steps:
- uses: actions/checkout@v3
- name: Download Ghidra
run: |
wget -P ${{matrix.root}} -q ${{matrix.release_url}}/${{matrix.filename}}
unzip -d ${{matrix.root}} -q ${{matrix.root}}/${{matrix.filename}}
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Build plugin via gradle
run: gradle -PGHIDRA_INSTALL_DIR=${{matrix.root}}/${{matrix.directory}}
- name: Rename ZIP for upload
run: mv dist/*_${{matrix.version}}_*.zip dist/ghidra_${{matrix.version}}_${{matrix.name}}.zip
- name: Check for Existing Asset
id: check_asset
run: |
asset_name=ghidra_${{matrix.version}}_${{matrix.name}}.zip
asset_id=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.event.release.tag_name }}" |
jq -r ".assets[] | select(.name == \"$asset_name\") | .id")
echo "Existing Asset ID: $asset_id"
echo "::set-output name=asset_id::$asset_id"
continue-on-error: true
- name: Delete Existing Asset
if: steps.check_asset.outputs.asset_id != ''
run: |
asset_id=${{ steps.check_asset.outputs.asset_id }}
echo "Deleting Asset ID: $asset_id"
curl -X DELETE \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id"
- name: Upload release ZIP
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh release upload ${{github.event.release.tag_name}} dist/ghidra_${{matrix.version}}_${{matrix.name}}.zip