diff --git a/.devops/scripts/github-release.sh b/.devops/scripts/github-release.sh
index 6c8fb82c..9eb47ba9 100644
--- a/.devops/scripts/github-release.sh
+++ b/.devops/scripts/github-release.sh
@@ -12,11 +12,11 @@ previous_release_version=$( \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/microsoft/gctoolkit/releases/latest | grep 'tag_name' \
)
-previous_release_version=$( perl -pe 's/"tag_name":\s+"(.*?)",?/$1/' <<< $previous_release_version )
+previous_release_version=$( perl -pe 's/"tag_name":\s+"(.*?)",?/$1/' <<< "${previous_release_version}" )
release_version=$( git tag --sort=-taggerdate --list | head -n 1 )
./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release \
- -Djreleaser.previous.tag.name=${previous_release_version} \
- -Djreleaser.tag.name=${release_version}
+ -Djreleaser.previous.tag.name="${previous_release_version}" \
+ -Djreleaser.tag.name="${release_version}"
diff --git a/.github/workflows/release_to_github.yml b/.github/workflows/release_to_github.yml
new file mode 100644
index 00000000..01e9bae3
--- /dev/null
+++ b/.github/workflows/release_to_github.yml
@@ -0,0 +1,58 @@
+name: Release to GitHub
+
+on:
+ workflow_dispatch:
+
+jobs:
+ release:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout project
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ ref: main
+ fetch-depth: 0
+
+ - name: Cache Maven
+ uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+
+ - name: Setup Java JDK
+ uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ with:
+ java-version: '11'
+ distribution: 'microsoft'
+
+ - name: Version
+ id: version
+ run: |
+ release_version=$( ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout )
+ release_version=${release_version%-*}
+ echo "version=${release_version}" >> "$GITHUB_ENV"
+
+ # Get the previous release version from what is actually on GitHub
+ previous_release_version=$( ./mvnw help:evaluate -Dexpression=project.scm.tag -q -DforceStdout )
+ echo "previous_version=${previous_release_version}" >> "$GITHUB_ENV"
+
+ - name: Release Prepare
+ run: |
+ ./mvnw -B -Prelease release:clean release:prepare \
+ -Drepository.url=https://${{ github.actor }}:${{ secrets.RELEASE_TOKEN }}@github.com/${{ github.repository }}.git
+ env:
+ GIT_AUTHOR_NAME: 'Git'
+ GIT_AUTHOR_EMAIL: 'noreply@github.com'
+ GIT_COMMITTER_NAME: 'Git'
+ GIT_COMMITTER_EMAIL: 'noreply@github.com'
+
+ - name: Release to GitHub
+ run: |
+ ./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release \
+ -Djreleaser.previous.tag.name="$previous_version" \
+ -Djreleaser.tag.name="$version"
+ env:
+ JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/pom.xml b/pom.xml
index 3d227f2f..7dd49eb7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -277,6 +277,15 @@
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ ${maven.release-plugin.version}
+
+ release
+ SemVerVersionPolicy
+
+
org.apache.maven.plugins
maven-surefire-plugin
@@ -432,19 +441,6 @@
apache-rat-plugin
true
-
-
- validate
-
- check
-
-
-
- gclogs/**
-
-
-
-
@@ -521,6 +517,15 @@
+
+ org.apache.maven.plugins
+ maven-release-plugin
+
+ gctoolkit-${project.version}
+ true
+ clean site
+
+