jDeploy CI with Maven #17
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
# This workflow will build a Java project with Maven and bundle them as native app installers with jDeploy | |
# See https://www.jdeploy.com for more information. | |
name: jDeploy CI with Maven | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Set up git | |
run: | | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --global user.name "${{ github.actor }}" | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Build App Installer Bundles | |
uses: shannah/jdeploy@master | |
with: | |
github_token: ${{ github.token }} | |
- name: Upload Build Artifacts for DMG Action | |
if: ${{ vars.JDEPLOY_CREATE_DMG == 'true' }} # Only needed if creating DMG | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-target | |
path: ./target | |
create_and_upload_dmg: | |
# Enable DMG creation by setting JDEPLOY_CREATE_DMG variable on the repo. | |
# See https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-an-environment | |
if: ${{ vars.JDEPLOY_CREATE_DMG == 'true' }} | |
name: Create and upload DMG | |
permissions: | |
contents: write | |
runs-on: macos-latest | |
needs: build | |
steps: | |
- name: Set up Git | |
run: | | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --global user.name "${{ github.actor }}" | |
- uses: actions/checkout@v3 | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-target | |
path: ./target | |
- name: Create DMG and Upload to Release | |
uses: shannah/jdeploy-action-dmg@main | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
developer_id: ${{ secrets.MAC_DEVELOPER_ID }} | |
# Team ID and cert name only needed if it can't extract from the certifcate for some reason | |
# developer_team_id: ${{ secrets.MAC_DEVELOPER_TEAM_ID }} | |
# developer_certificate_name: ${{ secrets.MAC_DEVELOPER_CERTIFICATE_NAME }} | |
developer_certificate_p12_base64: ${{ secrets.MAC_DEVELOPER_CERTIFICATE_P12_BASE64 }} | |
developer_certificate_password: ${{ secrets.MAC_DEVELOPER_CERTIFICATE_PASSWORD }} | |
notarization_password: ${{ secrets.MAC_NOTARIZATION_PASSWORD }} |