Merge pull request #115 from sfuhrm/dependabot/maven/org.apache.loggi… #513
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: Package | |
on: | |
push: | |
branches: [ master ] | |
tags: [ v* ] | |
pull_request: | |
branches: [ master ] | |
env: | |
JPACKAGE_COMMON_OPTS: | | |
--name radiorecorder \ | |
--copyright "Stephan Fuhrmann" \ | |
--vendor "Stephan Fuhrmann" \ | |
--description "Records and plays internet radio streams" \ | |
--main-class de.sfuhrm.radiorecorder.Main \ | |
--dest jpackage-app \ | |
--verbose | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 21 | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Extract current maven version | |
run: echo "version=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | |
id: version | |
shell: bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-tgz | |
path: radiorecorder/target/radiorecorder-${{ steps.version.outputs.version }}-bin.tar.gz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-tbz | |
path: radiorecorder/target/radiorecorder-${{ steps.version.outputs.version }}-bin.tar.bz2 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-zip | |
path: radiorecorder/target/radiorecorder-${{ steps.version.outputs.version }}-bin.zip | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: radiorecorder/target/radiorecorder-${{ steps.version.outputs.version }}-app | |
jpackage_linux: | |
needs: build | |
outputs: | |
packagename: ${{ steps.packagename.outputs.packagename }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
container: debian:10 | |
jpkg_type: deb | |
style: debian | |
- os: ubuntu-latest | |
container: oraclelinux:8.5 | |
jpkg_type: rpm | |
style: redhat | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container }} | |
env: | |
PACKAGE_VERSION: ${{ needs.build.outputs.version }} | |
steps: | |
- name: Download build | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: build | |
- name: Setup Debian container | |
run: | | |
echo "List of current dir:" | |
ls -alR | |
echo "Debian version:" | |
cat /etc/debian_version | |
apt-get update | |
apt-get install -y --no-install-recommends curl openssh-client git fakeroot curl binutils | |
if: matrix.style == 'debian' | |
- name: Setup OracleLinux container | |
run: | | |
echo "List of current dir:" | |
ls -alR | |
yum install --assumeyes rpm-build git openssh-clients | |
if: matrix.style == 'redhat' | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- name: Build package | |
run: | | |
if test "${{ matrix.style }}" = "redhat"; then | |
PACKAGE_VERSION=$(echo ${PACKAGE_VERSION} | cut -d"-" -f1) | |
echo "Fixing RPM version to ${PACKAGE_VERSION}" | |
fi | |
APPDIR=$(pwd)/radiorecorder-${{ needs.build.outputs.version }} | |
jpackage \ | |
--main-jar lib/radiorecorder-${{ needs.build.outputs.version }}.jar \ | |
--type ${{ matrix.jpkg_type }} \ | |
--app-version ${PACKAGE_VERSION} \ | |
--input ${APPDIR} \ | |
--license-file ${APPDIR}/LICENSE \ | |
--linux-deb-maintainer s@sfuhrm.de \ | |
--linux-app-category sound \ | |
--install-dir /usr \ | |
${{ env.JPACKAGE_COMMON_OPTS }} | |
- name: Extract package name | |
run: echo "packagename=$(ls)" >> $GITHUB_OUTPUT | |
working-directory: jpackage-app | |
id: packagename | |
shell: bash | |
- name: Test install package Debian | |
run: apt-get install --assume-yes ./jpackage-app/${{ steps.packagename.outputs.packagename }} | |
if: matrix.style == 'debian' | |
- name: Test install package RPM | |
run: yum localinstall --assumeyes ./jpackage-app/${{ steps.packagename.outputs.packagename }} | |
if: matrix.style == 'redhat' | |
- name: Test run application | |
run: radiorecorder -V | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-${{ matrix.jpkg_type }} | |
path: jpackage-app/${{ steps.packagename.outputs.packagename }} | |
jpackage_macos: | |
needs: build | |
outputs: | |
packagename: ${{ steps.packagename.outputs.packagename }} | |
strategy: | |
matrix: | |
include: | |
- jpkg_type: dmg | |
- jpkg_type: pkg | |
runs-on: macos-latest | |
env: | |
PACKAGE_VERSION: ${{ needs.build.outputs.version }} | |
steps: | |
- name: Download build | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: build | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- name: Build package | |
run: | | |
APPDIR=$(pwd)/radiorecorder-${{ needs.build.outputs.version }} | |
PACKAGE_VERSION=$(echo ${PACKAGE_VERSION} | cut -d"-" -f1) | |
jpackage \ | |
--main-jar lib/radiorecorder-${{ needs.build.outputs.version }}.jar \ | |
--type ${{ matrix.jpkg_type }} \ | |
--app-version ${PACKAGE_VERSION} \ | |
--input ${APPDIR} \ | |
--license-file ${APPDIR}/LICENSE \ | |
--install-dir /Applications \ | |
${{ env.JPACKAGE_COMMON_OPTS }} | |
- name: Extract package name | |
run: echo "packagename=$(ls)" >> $GITHUB_OUTPUT | |
working-directory: jpackage-app | |
id: packagename | |
shell: bash | |
- name: Test install package MacOS PKG | |
run: sudo installer -verbose -pkg ./jpackage-app/${{ steps.packagename.outputs.packagename }} -target / | |
if: matrix.jpkg_type == 'pkg' | |
- name: Test run application | |
run: ./radiorecorder -V | |
working-directory: /Applications/radiorecorder.app/Contents/MacOS | |
if: matrix.jpkg_type == 'pkg' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-${{ matrix.jpkg_type }} | |
path: jpackage-app/${{ steps.packagename.outputs.packagename }} | |
jpackage_windows: | |
needs: build | |
outputs: | |
packagename: ${{ steps.packagename.outputs.packagename }} | |
strategy: | |
matrix: | |
include: | |
- jpkg_type: exe | |
- jpkg_type: msi | |
runs-on: windows-latest | |
env: | |
PACKAGE_VERSION: ${{ needs.build.outputs.version }} | |
steps: | |
- name: Download build | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: build | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- name: Build package | |
run: | | |
APPDIR=$(pwd)/radiorecorder-${{ needs.build.outputs.version }} | |
PACKAGE_VERSION=$(echo ${PACKAGE_VERSION} | cut -d"-" -f1) | |
jpackage \ | |
--main-jar lib/radiorecorder-${{ needs.build.outputs.version }}.jar \ | |
--type ${{ matrix.jpkg_type }} \ | |
--app-version ${PACKAGE_VERSION} \ | |
--input ${APPDIR} \ | |
--license-file ${APPDIR}/LICENSE \ | |
--win-console \ | |
--win-upgrade-uuid a32f7c72-87d5-44ab-91b6-1f4e13fea46b \ | |
${{ env.JPACKAGE_COMMON_OPTS }} | |
shell: bash | |
- name: Extract package name | |
run: echo "packagename=$(ls)" >> $GITHUB_OUTPUT | |
working-directory: jpackage-app | |
id: packagename | |
shell: bash | |
- name: Test install package Windows MSI | |
run: msiexec /quiet /passive /i ${{ steps.packagename.outputs.packagename }} | |
working-directory: jpackage-app | |
if: matrix.jpkg_type == 'msi' | |
- name: dir | |
run: ls | |
working-directory: "C:\\Program Files\\radiorecorder" | |
shell: bash | |
if: matrix.jpkg_type == 'msi' | |
- name: Test run application | |
run: ./radiorecorder -V | |
working-directory: "C:\\Program Files\\radiorecorder" | |
shell: bash | |
if: matrix.jpkg_type == 'msi' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-${{ matrix.jpkg_type }} | |
path: jpackage-app/${{ steps.packagename.outputs.packagename }} | |
merge_packages: | |
needs: | |
- build | |
- jpackage_linux | |
- jpackage_macos | |
- jpackage_windows | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download package artifacts | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
path: packages | |
pattern: packages-* | |
merge-multiple: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: packages |