Merge pull request #178 from xdev-software/develop #42
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish package to the Maven Central Repository | |
on: | |
push: | |
branches: [ main ] | |
env: | |
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }} | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
check_build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Build with Maven | |
run: mvn -B clean verify | |
prepare_release: | |
runs-on: ubuntu-latest | |
needs: [check_build] | |
outputs: | |
upload_url: ${{ steps.create_draft.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure Git | |
run: | | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
- name: Un-SNAP | |
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false | |
- name: Get version | |
id: version | |
run: | | |
echo "release=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | |
- name: Commit and Push | |
run: | | |
git add -A | |
git commit -m "Release ${{ steps.version.outputs.release }}" | |
git push origin | |
git tag v${{ steps.version.outputs.release }} | |
git push origin --tags | |
- name: Create Release | |
id: create_release | |
uses: shogo82148/actions-create-release@v1 | |
with: | |
tag_name: v${{ steps.version.outputs.release }} | |
release_name: v${{ steps.version.outputs.release }} | |
commitish: main | |
body: | | |
## [Changelog](https://github.com/xdev-software/${{ env.PRIMARY_MAVEN_MODULE }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) | |
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/xdev-software/${{ env.PRIMARY_MAVEN_MODULE }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information. | |
## Installation | |
Add the following lines to your pom: | |
```XML | |
<dependency> | |
<groupId>software.xdev</groupId> | |
<artifactId>micro-migration-microstream-v8</artifactId> | |
<version>${{ steps.version.outputs.release }}</version> | |
</dependency> | |
``` | |
publish_central: | |
runs-on: ubuntu-latest | |
needs: [prepare_release] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# This might seem strange, but in order to see the Version update from the previous step, | |
# we must pull this change from git. | |
- name: Init Git and pull | |
run: | | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
git pull | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Publish | |
env: | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }} | |
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn -B -pl !examples -Prelease deploy org.jreleaser:jreleaser-maven-plugin:deploy -DaltDeploymentRepository=local::default::file:./target/staging-deploy | |
after_release: | |
runs-on: ubuntu-latest | |
needs: [publish_central] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Init Git and pull | |
run: | | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
git pull | |
- name: Inc Version and SNAP root | |
run: mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true | |
- name: Git Commit and Push | |
run: | | |
git add -A | |
git commit -m "Preparing for next development iteration" | |
git push origin | |
- name: pull-request | |
uses: repo-sync/pull-request@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
destination_branch: "develop" | |
pr_title: "Sync back" | |
pr_body: "An automated PR to sync changes back" |