diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4856cdc..bf87e38 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,47 +22,9 @@ jobs: distribution: 'temurin' cache: maven - - name: Get version from pom.xml - id: get_version - run: | - VERSION=$(grep -m1 '' pom.xml | sed 's/[[:space:]]*\(.*\)<\/version>.*/\1/') - # Strip any suffix after version numbers (like -SNAPSHOT) - BASE_VERSION=$(echo "$VERSION" | sed 's/^\([0-9]\+\.[0-9]\+\)[^0-9].*/\1/') - echo "VERSION=$BASE_VERSION" >> $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 - echo "Set BUILD_VERSION to ${VERSION}" - else - SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8) - TIMESTAMP=$(date +"%Y%m%d-%H%M%S") - LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") - if [ -z "$LATEST_TAG" ]; then - BASE_VERSION="${{ steps.get_version.outputs.VERSION }}" - else - BASE_VERSION="${LATEST_TAG#v}" - fi - FULL_VERSION="${BASE_VERSION}-${SHORT_SHA}-${TIMESTAMP}" - echo "BUILD_VERSION=${FULL_VERSION}" >> $GITHUB_OUTPUT - echo "Set BUILD_VERSION to ${FULL_VERSION}" - 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>/{s/.*<\/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 + # 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 @@ -71,7 +33,9 @@ jobs: if: github.ref_type != 'tag' uses: actions/upload-artifact@v4 with: - name: GhydraMCP-${{ steps.set_version.outputs.BUILD_VERSION }} + # 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 @@ -101,6 +65,8 @@ jobs: 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 diff --git a/pom.xml b/pom.xml index 1c0bbee..d8ec04a 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,9 @@ true true yyyyMMdd-HHmmss - dev-SNAPSHOT + dev-SNAPSHOT + + ${git.commit.id.abbrev}-${maven.build.timestamp} @@ -152,6 +154,24 @@ build-helper-maven-plugin 3.4.0 + + + set-identifier-from-tag + initialize + + regex-property + + + build.identifier + ${git.closest.tag.name} + ^v?(.+)$ + $1 + false + + + + + @@ -180,10 +201,10 @@ GhydraMCP - ${git.commit.id.abbrev}-${maven.build.timestamp} + ${build.identifier} eu.starsong.ghidra.GhydraMCP GhydraMCP - ${git.commit.id.abbrev}-${maven.build.timestamp} + ${build.identifier} LaurieWired, Teal Bauer Expose multiple Ghidra tools to MCP servers with variable management @@ -213,7 +234,7 @@ src/assembly/ghidra-extension.xml - GhydraMCP-${git.commit.id.abbrev}-${maven.build.timestamp} + GhydraMCP-${build.identifier} false @@ -229,7 +250,7 @@ src/assembly/complete-package.xml - GhydraMCP-Complete-${git.commit.id.abbrev}-${maven.build.timestamp} + GhydraMCP-Complete-${build.identifier} false diff --git a/src/assembly/complete-package.xml b/src/assembly/complete-package.xml index f55b079..6425d0f 100644 --- a/src/assembly/complete-package.xml +++ b/src/assembly/complete-package.xml @@ -26,7 +26,8 @@ ${project.build.directory} - GhydraMCP-${project.version}.zip + + GhydraMCP-${build.identifier}.zip