small improvements #708
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: GitHub Build | |
on: | |
push: | |
branches: [ "master" ] | |
tags: [ "v*.*.*" ] | |
pull_request: | |
branches: [ "master" ] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java-version: [ 21, 23 ] | |
name: Build with Java ${{ matrix.java-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java-version }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java-version }} | |
cache: 'maven' | |
- name: Build with Maven (Linux) | |
run: | | |
xvfb-run -a mvn -B -V -ntp -Djansi.passthrough=true -Dstyle.color=always package | |
rm target/original-*.jar | |
- name: Put the current date in the environment file | |
run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Archive artifacts | |
if: matrix.java-version == 21 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PixelitorJAR-${{ env.DATE }} | |
path: target/*.jar | |
if-no-files-found: error | |
- name: Draft a release if a v* tag is pushed | |
if: matrix.java-version == 21 && startsWith(github.ref, 'refs/tags/v') | |
env: | |
GITHUB_TOKEN: ${{ github.TOKEN }} | |
run: | | |
DATE=$(date +"%b %-d, %Y") | |
TAG_NAME=${GITHUB_REF#refs/tags/v} | |
gh release create "v$TAG_NAME" --draft --title "$TAG_NAME - released on $DATE" target/*.jar | |