Skip to content

release-to-maven-central #75

release-to-maven-central

release-to-maven-central #75

name: release-to-maven-central
on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
default: '2.4.0'
jobs:
publish-central-and-pages:
runs-on: ubuntu-latest
steps:
- run: echo "Will start a Maven Central upload with version ${{ github.event.inputs.releaseversion }}"
- uses: actions/checkout@v3
- name: Set up settings.xml for Maven Central Repository
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
server-id: oss.sonatype.org
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Cache local Maven repository
uses: actions/[email protected]
env:
cache-name: cache-mvn
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Set projects Maven version to GitHub Action GUI set version
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress
- name: Publish package
run: mvn --batch-mode clean deploy --no-transfer-progress -P central-deploy -DskipTests=true
env:
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Deploy Asciidoc docs output to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: spring-boot-admin-docs/target/generated-docs # The folder the action should deploy.
target-folder: ${{ github.event.inputs.releaseversion }}
clean: true # Automatically remove deleted files from the deploy branch
publish-github-release:
needs: publish-central-and-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.releaseversion }}
release_name: ${{ github.event.inputs.releaseversion }}
body: |
Grab the new version from Maven central https://repo1.maven.org/maven2/de/codecentric/
Current docs at https://codecentric.github.io/spring-boot-admin/${{ github.event.inputs.releaseversion }}/
### Things that changed in this release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: ${{ contains(github.event.inputs.releaseversion, '-') }}