Maven Release #7
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: Maven Release | |
on: | |
pull_request: | |
types: [closed] | |
paths: | |
- '.github/project.yml' | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
name: release | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false # otherwise, the token used is the PA_TOKEN, instead of your personal access token. | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- uses: radcortez/project-metadata-action@1.1 | |
name: Retrieve project metadata from '.github/project.yml' | |
id: metadata | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
metadata-file-path: '.github/project.yml' | |
local-file: true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
server-id: sonatype-nexus-snapshots | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_CENTRAL_TOKEN | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
cache: maven | |
- name: Configure Git author | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "Cuioss Robot Action" | |
- name: Maven release ${{steps.metadata.outputs.current-version}} | |
run: | | |
git checkout -b release | |
mvn -B -Prelease release:clean release:prepare -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} | |
mvn -B -Prelease javadoc:aggregate site:site site:stage | |
git checkout ${{vars.GITHUB_BASE_REF}} | |
git rebase release | |
mvn -B -Prelease release:perform -DskipTests | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSS_SONATYPE_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Deploy Maven Site to cuioss.github.io -> ${{steps.metadata.outputs.pages-reference}}🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: target/site | |
repository-name: cuioss/cuioss.github.io | |
target-folder: ${{steps.metadata.outputs.pages-reference}} | |
branch: main | |
token: ${{ secrets.PAGES_DEPLOY_TOKEN }} | |
# | |
- name: Push changes to ${{github.ref_name}} | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{github.ref_name}} | |
force: true | |
- name: Push tag ${{steps.metadata.outputs.current-version}} | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
branch: ${{github.ref_name}} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tags: true | |
force: true |