perform release #2
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: perform release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: 'The new version to be set. Leave it empty if you want Maven to set the next version automatically.' | |
required: false | |
type: string | |
permissions: | |
checks: read | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'zulu' | |
cache: 'maven' | |
server-id: 'maven.jenkins-ci.org' | |
server-username: 'MAVEN_USERNAME' | |
server-password: 'MAVEN_TOKEN' | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.9.9 | |
- name: Configure Git User | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: perform release | |
run: mvn -B -DskipTests -Dspotbugs.skip=true -DreleaseVersion=${{ inputs.release_version }} -Darguments="-DskipTests -Dspotbugs.skip=true" release:prepare release:perform | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
- name: extract version | |
id: current_version | |
shell: bash | |
run: | | |
echo "version=$(mvn -q -f target/checkout/pom.xml -DforceStdout help:evaluate -Dexpression=project.version)" >> $GITHUB_OUTPUT | |
- name: Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
validation_level: none | |
version: v${{ steps.current_version.outputs.version }} | |
path: ./CHANGELOG.md | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: target/checkout/target/dependency-track.hpi | |
artifactContentType: application/zip | |
draft: false | |
tag: v${{ steps.current_version.outputs.version }} | |
body: ${{ steps.changelog_reader.outputs.changes }} | |
token: ${{ secrets.GITHUB_TOKEN }} |