Skip to content

Commit

Permalink
WPR-9 - Add multi OS support
Browse files Browse the repository at this point in the history
  • Loading branch information
nadav-yo committed Jan 22, 2024
1 parent ed3ade2 commit 9ef1cba
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 25 deletions.
108 changes: 89 additions & 19 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,123 @@ name: Release next version
on: workflow_dispatch

jobs:
build:
name: Build ${{ github.run_number }}
setVersion:
runs-on: ubuntu-latest

outputs:
nextVersion: ${{ steps.set.outputs.nextVersion }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
fetch-depth: 0
- name: Get previous tag
id: previoustag
uses: 'WyriHaximus/github-action-get-previous-tag@v1'
with:
fallback: '0.0.0' # Fallback tag when no previous tag is found
fallback: '0.0.0'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get next version
id: semver
uses: 'WyriHaximus/github-action-next-semvers@v1'
with:
version: ${{ steps.previoustag.outputs.tag }}
- name: Set Variable
id: set
run: |
echo "nextVersion=\"${{ steps.semver.outputs.patch }}\"" >> $GITHUB_ENV
echo "nextVersion=\"${{ steps.semver.outputs.patch }}\"" >> $GITHUB_OUTPUT
build:
needs: setVersion
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
name: Build ${{ github.run_number }}
runs-on: ${{ matrix.os }}
outputs:
nextVersion: ${{ needs.setVersion.outputs.nextVersion }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Change Version
run: mvnw versions:set -DnewVersion=${{ steps.semver.outputs.patch }}
run: mvn versions:set -DnewVersion=${{ needs.setVersion.outputs.nextVersion }}
- name: Build with Maven
run: mvnw -B package --file pom.xml
run: mvn -B package --file pom.xml
- name: Test with Maven
run: mvnw test
run: mvn test
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: target-${{ matrix.os }}
path: ./target

release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Remove Quotes from Version
run: |
version="${{ needs.build.outputs.nextVersion }}"
version=$(echo "${version}" | sed 's/"//g')
echo "cleanedVersion=${version}" >> $GITHUB_OUTPUT
id: remove_quotes
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.semver.outputs.patch }}
release_name: Release ${{ steps.semver.outputs.patch }}
- name: Upload Release Asset
tag_name: ${{ steps.remove_quotes.outputs.cleanedVersion }}
release_name: Release ${{ steps.remove_quotes.outputs.cleanedVersion }}
- name: Download Artifacts (Windows)
uses: actions/download-artifact@v2
with:
name: target-windows-latest
path: ./target-windows
- name: Download Artifacts (Linux)
uses: actions/download-artifact@v2
with:
name: target-ubuntu-latest
path: ./target-linux
- name: Download Artifacts (MacOS)
uses: actions/download-artifact@v2
with:
name: target-macos-latest
path: ./target-macos
- name: Upload Release Asset (Windows)
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GHATKN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/waypoint-replace-${{ steps.semver.outputs.patch }}.jar
asset_name: waypoint-replace-${{ steps.semver.outputs.patch }}.jar
asset_path: ./target-windows/waypoint-replace-${{ steps.remove_quotes.outputs.cleanedVersion }}.jar
asset_name: waypoint-replace-${{ steps.remove_quotes.outputs.cleanedVersion }}-windows.jar
asset_content_type: application/java-archive
- name: Upload Release Asset (Linux)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GHATKN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target-linux/waypoint-replace-${{ steps.remove_quotes.outputs.cleanedVersion }}.jar
asset_name: waypoint-replace-${{ steps.remove_quotes.outputs.cleanedVersion }}-linux.jar
asset_content_type: application/java-archive
- name: Upload Release Asset (MacOS)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GHATKN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target-macos/waypoint-replace-${{ steps.remove_quotes.outputs.cleanedVersion }}.jar
asset_name: waypoint-replace-${{ steps.remove_quotes.outputs.cleanedVersion }}-macos.jar
asset_content_type: application/java-archive
7 changes: 1 addition & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.2.0</spring.version>
<javfx.version>20.0.2</javfx.version>
<javfx.version>21.0.2</javfx.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -63,11 +63,6 @@
<artifactId>javafx-fxml</artifactId>
<version>${javfx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>21.0.2</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
Expand Down

0 comments on commit 9ef1cba

Please sign in to comment.