Initial commit #1
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: Create release tag on master | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
create-release: | |
name: 📌 Create release tag on master | |
runs-on: judong | |
timeout-minutes: 30 | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: ⬇️ Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 🧹 Remove toolchains.xml | |
run: rm $HOME/.m2/toolchains.xml || true | |
- name: 🛠️ Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
- name: 🧹 Remove settings.xml | |
run: rm $HOME/.m2/settings.xml || true | |
- name: 🛠️ Setup maven settings.xml | |
uses: whelk-io/maven-settings-xml-action@v21 | |
with: | |
servers: > | |
[ | |
{ | |
"id": "judong-nexus-mirror", | |
"username": "${{ secrets.JUDONG_NEXUS_USERNAME }}", | |
"password": "${{ secrets.JUDONG_NEXUS_PASSWORD }}" | |
}, | |
{ | |
"id": "judong-nexus-distribution", | |
"username": "${{ secrets.JUDONG_NEXUS_USERNAME }}", | |
"password": "${{ secrets.JUDONG_NEXUS_PASSWORD }}" | |
}, | |
{ | |
"id": "ossrh", | |
"username": "${{ secrets.SONATYPE_USERNAME }}", | |
"password": "${{ secrets.SONATYPE_PASSWORD }}" | |
} | |
] | |
mirrors: > | |
[ | |
{ | |
"id": "judong-nexus-mirror", | |
"mirrorOf": "*", | |
"url": "https://nexus.judo.technology/repository/maven-judong/" | |
} | |
] | |
- name: 🔢 Calculate version number | |
id: version | |
run: |- | |
POM_VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dtycho.mode=maven -DskipModules=true -Dexpression=project.version -q -DforceStdout) | |
if [[ "${POM_VERSION}" == *-SNAPSHOT ]]; then | |
BASE_VERSION=$(echo "${POM_VERSION}" | cut -d'-' -f 1) | |
else | |
BASE_VERSION=${POM_VERSION} | |
fi | |
if [[ "${{ github.base_ref }}" == "master" ]]; then | |
VERSION_NUMBER=${BASE_VERSION} | |
else | |
TAG_NAME=$(echo "${{ steps.context.outputs.branch }}" | cut -d ' ' -f2 | tr '#\/\.-' '_') | |
fi | |
echo "Version from POM: ${POM_VERSION}" | |
echo "Base version from POM: ${BASE_VERSION}" | |
echo "version=${BASE_VERSION}" >> $GITHUB_OUTPUT | |
- name: 🏗️ Build Changelog | |
id: create_changelog | |
uses: mikepenz/release-changelog-builder-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
toTag: v${{ steps.version.outputs.version }} | |
- name: 📖 Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: v${{ steps.version.outputs.version }} | |
tag: v${{ steps.version.outputs.version }} | |
generateReleaseNotes: false | |
body: ${{steps.create_changelog.outputs.changelog}} | |
draft: false | |
prerelease: false | |
- name: 📢 Send error to discord | |
uses: sarisia/actions-status-discord@v1 | |
if: ${{ always() && job.status == 'failure' }} | |
with: | |
webhook: ${{ secrets.JUDONG_DISCORD_WEBHOOK }} | |
title: "Github action" | |
description: ":x: Could not trigger github release! https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" |