78 lines
2.3 KiB
YAML

name: Build Ghidra Plugin
on:
push:
branches: [ main, 'api-*', 'feature/*', 'bugfix/*' ]
tags:
- 'v*'
pull_request:
branches: [ main ]
permissions:
contents: write
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
# Removed steps that get/set/update version in files.
# pom.xml now handles determining the build identifier (tag or commit hash/timestamp)
# and uses it for artifact naming. extension.properties version remains untouched.
- name: Build with Maven
run: mvn -B package
- name: Upload nightly artifacts
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
# Use a generic name for nightly artifacts
name: GhydraMCP-nightly
# Path will grab both standard and complete zips generated by Maven
path: |
target/GhydraMCP-*.zip
bridge_mcp_hydra.py
- name: Generate Release Notes from CHANGELOG
if: github.ref_type == 'tag'
id: generate_notes
run: |
# Extract version without v prefix
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}"
# Extract the changelog section for this version
awk -v version="$VERSION" '
BEGIN { print_section=0; }
$0 ~ "^## \\[" version "\\]" { print_section=1; next }
$0 ~ "^## \\[" && print_section { print_section=0; next }
print_section
' CHANGELOG.md > release_notes.md
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 }}
# The files pattern will grab both standard and complete zips.
# Maven (via pom.xml) ensures they are named correctly based on the tag.
files: |
target/GhydraMCP-*.zip
bridge_mcp_hydra.py
draft: false
prerelease: false