Build Desktop Release #4
Workflow file for this run
This file contains hidden or 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
| # The name of the workflow | |
| name: Build Desktop Release | |
| # The trigger for the workflow | |
| on: | |
| release: | |
| types: [published] | |
| # The jobs to be run | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| # Step 1: Check out the code | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| # Step 2: Set up the Java JDK | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'adopt' | |
| # Step 3: Grant execute permission to gradlew (for macOS and Linux) | |
| - name: Grant execute permission for gradlew | |
| if: matrix.os != 'windows-latest' | |
| run: chmod +x gradlew | |
| # Step 4: Build the app | |
| - name: Build with Gradle | |
| run: ./gradlew packageReleaseDistribution | |
| # Step 5: Upload the generated installer to the release | |
| - name: Upload Release Artifact | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| upload_url: ${{ github.event.release.upload_url }} | |
| # The path now correctly points to the final installer files. | |
| asset_path: | | |
| ${{ matrix.os == 'windows-latest' && format('{0}/shared/build/compose/binaries/main-release/msi/*.msi', github.workspace) || '' }} | |
| ${{ matrix.os == 'macos-latest' && format('{0}/shared/build/compose/binaries/main-release/dmg/*.dmg', github.workspace) || '' }} | |
| ${{ matrix.os == 'ubuntu-latest' && format('{0}/shared/build/compose/binaries/main-release/deb/*.deb', github.workspace) || '' }} | |
| asset_name: | | |
| ${{ matrix.os == 'windows-latest' && 'AgeCalculator-windows-installer.msi' || '' }} | |
| ${{ matrix.os == 'macos-latest' && 'AgeCalculator-macOS-installer.dmg' || '' }} | |
| ${{ matrix.os == 'ubuntu-latest' && 'AgeCalculator-linux-installer.deb' || '' }} | |
| asset_content_type: application/octet-stream |