Use artifacts instead of building again #3522
Workflow file for this run
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: Test | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
jar-and-media: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v7 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '21' | |
check-latest: true | |
cache: 'gradle' | |
- uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: wrapper | |
- uses: luangong/setup-install4j@v1 | |
with: | |
version: 10.0.8 | |
license: ${{ secrets.INSTALL4J_LICENSE }} | |
- name: Set Permissions | |
run: | | |
chmod +x gradlew | |
- name: Build with Gradle | |
run: | | |
./gradlew -Pversion="${{ steps.branch-name.outputs.current_branch }}" generateLicenseReport --info --full-stacktrace | |
./gradlew -Pversion="${{ steps.branch-name.outputs.current_branch }}" build --info --full-stacktrace | |
./gradlew -Pversion="${{ steps.branch-name.outputs.current_branch }}" media --info --full-stacktrace | |
- uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: jar-and-media | |
path: | | |
media | |
build | |
buildSrc/build | |
serverpackcreator-api/build | |
serverpackcreator-app/build | |
serverpackcreator-web-frontend/dist | |
serverpackcreator-plugin-example/build | |
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn` | |
executables: | |
name: Executable on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v7 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '21' | |
distribution: 'graalvm-community' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
native-image-job-reports: 'true' | |
set-java-home: 'true' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: jar-and-media | |
- name: Build and run HelloWorld.java | |
run: | | |
cd serverpackcreator-app/build/libs | |
native-image -jar serverpackcreator-app-${{ steps.branch-name.outputs.current_branch }}.jar -o ServerPackCreator-${{ steps.branch-name.outputs.current_branch }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ServerPackCreator-${{ matrix.os }} | |
path: serverpackcreator-app/build/libs/ServerPackCreator* |