- Create a complete package containing both plugin and bridge script - Update GitHub Actions workflow to use Maven-generated artifacts - Add Maven profiles to selectively build plugin-only or complete-package - Improve Maven configuration with UTF-8 encoding and dependency cleanup - Fix Maven warnings for system paths and unused dependencies - Upgrade Java version to 21 for compatibility with latest Ghidra - Update README with enhanced build instructions
108 lines
3.5 KiB
YAML
108 lines
3.5 KiB
YAML
name: Build Ghidra Plugin
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
cache: maven
|
|
|
|
- name: Get version from pom.xml
|
|
id: get_version
|
|
run: echo "VERSION=$(grep -m1 '<version>' pom.xml | sed 's/[[:space:]]*<version>\(.*\)<\/version>.*/\1/')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set build version
|
|
id: set_version
|
|
run: |
|
|
if [[ "${{ github.ref_type }}" == "tag" ]]; then
|
|
VERSION="${{ github.ref_name }}"
|
|
VERSION="${VERSION#v}"
|
|
echo "BUILD_VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
else
|
|
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
|
|
echo "BUILD_VERSION=${{ steps.get_version.outputs.VERSION }}-nightly-$SHORT_SHA" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Update version in files
|
|
run: |
|
|
VERSION="${{ steps.set_version.outputs.BUILD_VERSION }}"
|
|
# Update pom.xml - only update the first version tag which is the project version
|
|
sed -i '0,/<version>.*<\/version>/{s/<version>.*<\/version>/<version>'"$VERSION"'<\/version>/}' pom.xml
|
|
# Update MANIFEST.MF
|
|
sed -i "s/Bundle-Version: .*/Bundle-Version: $VERSION/" src/main/resources/META-INF/MANIFEST.MF
|
|
# Update extension.properties if it has version
|
|
if grep -q "^version=" src/main/resources/extension.properties; then
|
|
sed -i "s/^version=.*/version=$VERSION/" src/main/resources/extension.properties
|
|
fi
|
|
|
|
- name: Build with Maven
|
|
run: mvn -B package
|
|
|
|
- name: Upload nightly artifacts
|
|
if: github.ref_type != 'tag'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: GhydraMCP-${{ steps.set_version.outputs.BUILD_VERSION }}
|
|
path: |
|
|
target/GhydraMCP-*.zip
|
|
bridge_mcp_hydra.py
|
|
target/GhydraMCP-Complete-*.zip
|
|
|
|
- name: Generate Release Notes
|
|
if: github.ref_type == 'tag'
|
|
id: generate_notes
|
|
run: |
|
|
# Extract version without v prefix
|
|
VERSION="${{ github.ref_name }}"
|
|
VERSION="${VERSION#v}"
|
|
|
|
# Get commit messages since last tag
|
|
LAST_TAG=$(git describe --tags --abbrev=0 "v${VERSION}^" 2>/dev/null || echo "")
|
|
if [ -z "$LAST_TAG" ]; then
|
|
# If no previous tag exists, get all commits
|
|
COMMITS=$(git log --pretty=format:"- %s" --no-merges)
|
|
else
|
|
# Get commits between last tag and current tag
|
|
COMMITS=$(git log --pretty=format:"- %s" --no-merges ${LAST_TAG}..HEAD)
|
|
fi
|
|
|
|
# Create release notes file
|
|
cat > release_notes.md << EOF
|
|
# Release v${VERSION}
|
|
|
|
## What's Changed
|
|
${COMMITS}
|
|
|
|
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${LAST_TAG}...v${VERSION}
|
|
EOF
|
|
|
|
echo "RELEASE_NOTES_FILE=release_notes.md" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Release
|
|
if: github.ref_type == 'tag'
|
|
id: create_release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: Release ${{ github.ref_name }}
|
|
body_path: ${{ steps.generate_notes.outputs.RELEASE_NOTES_FILE }}
|
|
files: |
|
|
target/GhydraMCP-*.zip
|
|
bridge_mcp_hydra.py
|
|
target/GhydraMCP-Complete-*.zip
|
|
draft: false
|
|
prerelease: false |