From: Debayan Sutradhar Date: Fri, 18 Jun 2021 23:28:43 +0530 Subject: Add proper workflow --- Add proper workflow --- --- /dev/null +++ b/.github/scripts/jpackage.bat @@ -0,0 +1,28 @@ +set /p REQ_MODULES=> $GITHUB_ENV + - name: Calculate required modules + run: | + JDEPS_MODULES=$(jdeps --module-path $JAVAFX_SDK/:target/lib/ --print-module-deps --ignore-missing-deps target/lib/client-$VERSION.jar) + JAVAFX_MODULES=javafx.fxml,javafx.media,javafx.swing,javafx.web + echo "REQ_MODULES=$JDEPS_MODULES,$JAVAFX_MODULES" >> $GITHUB_ENV + env: + JAVAFX_SDK: /tmp/javafx-sdk-17/lib/ + - name: Saving REQ_MODULES + run: | + echo $REQ_MODULES > req_modules.txt + - name: Uploading REQ_MODULES + uses: actions/upload-artifact@v2 + with: + name: req_modules + path: req_modules.txt + - name: Saving VERSION + run: | + echo $VERSION > version.txt + - name: Uploading VERSION + uses: actions/upload-artifact@v2 + with: + name: version + path: version.txt \ No newline at end of file --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,81 @@ +name: Build Linux +on: + workflow_run: + workflows: ["Build Essential Actions"] + types: + - completed + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Install packages + run: sudo apt install xdg-utils libc6 xdg-utils zlib1g libpng16-16 libasound2 libbsd-dev zip libblkid1 libdbus-1-3 libexpat1 libgpg-error0 liblzma5 libmount1 libpcre3 libselinux1 libsystemd0 libuuid1 + - uses: actions/checkout@v2 + - name: Setup java + uses: joschi/setup-jdk@v2 + with: + java-version: 16 + - name: Setup JavaFX + run: | + wget -P /tmp https://download2.gluonhq.com/openjfx/17/openjfx-17-ea+11_linux-x64_bin-jmods.zip + unzip /tmp/openjfx-17-ea+11_linux-x64_bin-jmods.zip -d /tmp + - name: Download built jars + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: built-jars + path: target/lib/ + - name: Download REQ_MODULES + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: req_modules + - name: Download VERSION + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: version + - name: Add VERSION to environment + run: | + echo "VERSION=$(> $GITHUB_ENV + - name: Add REQ_MODULES to environment + run: | + echo "REQ_MODULES=$(> $GITHUB_ENV + - name: Create Bundle using JPackage + run: | + # Create DEB + .github/scripts/jpackage.sh \ + --icon assets/linux-icon.png \ + --app-version ${{ env.VERSION }} \ + --linux-menu-group "Stream-Pi" \ + --license-file LICENSE.txt \ + --type deb + + # Create App Image + .github/scripts/jpackage.sh \ + --icon assets/linux-icon.png \ + --app-version ${{ env.VERSION }} \ + --type app-image + + cd $INSTALL_DIR + mv *.deb stream-pi-client-linux-x64-${{ env.VERSION }}-debian.deb + mv 'Stream-Pi Client' stream-pi-client-${{ env.VERSION }} + zip -r stream-pi-client-linux-x64-${{ env.VERSION }}-executable.zip stream-pi-client-${{ env.VERSION }} + rm -r stream-pi-client-${{ env.VERSION }} + env: + MAIN_CLASS: com.stream_pi.client.Main + JAVAFX_JMODS: /tmp/javafx-jmods-17/ + JPACKAGE_HOME: ${{ env.JAVA_HOME }} + INSTALL_DIR: target/install + - name: Saving Linux x64 DEB + uses: actions/upload-artifact@v2 + with: + name: linux-deb + path: target/install/stream-pi-client-linux-x64-${{ env.VERSION }}-debian.deb + - name: Saving Linux x64 ZIP + uses: actions/upload-artifact@v2 + with: + name: linux-zip + path: target/install/stream-pi-client-linux-x64-${{ env.VERSION }}-executable.zip + --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,63 @@ +name: Build MacOS +on: + workflow_run: + workflows: ["Build Linux"] + types: + - completed + +jobs: + build: + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + - name: Setup java + uses: joschi/setup-jdk@v2 + with: + java-version: 16 + - name: Setup JavaFX + run: | + wget -P /tmp https://download2.gluonhq.com/openjfx/17/openjfx-17-ea+11_linux-x64_bin-jmods.zip + unzip /tmp/openjfx-17-ea+11_linux-x64_bin-jmods.zip -d /tmp + - name: Download built jars + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: built-jars + path: target/lib/ + - name: Download REQ_MODULES + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: req_modules + - name: Download VERSION + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: version + - name: Add VERSION to environment + run: | + echo "VERSION=$(> $GITHUB_ENV + - name: Add REQ_MODULES to environment + run: | + echo "REQ_MODULES=$(> $GITHUB_ENV + - name: Create Bundle using JPackage + run: | + # Create DMG + .github/scripts/jpackage.sh \ + --icon assets/macos-icon.icns \ + --license-file LICENSE.txt \ + --type dmg + + cd $INSTALL_DIR + mv *.dmg stream-pi-client-macos-x64-${{ env.VERSION }}.dmg + env: + MAIN_CLASS: com.stream_pi.client.Main + JAVAFX_JMODS: /tmp/javafx-jmods-17/ + JPACKAGE_HOME: ${{ env.JAVA_HOME }} + INSTALL_DIR: target/install + - name: Saving MacOS x64 DMG + uses: actions/upload-artifact@v2 + with: + name: macos-dmg + path: target/install/stream-pi-client-macos-x64-${{ env.VERSION }}.dmg + --- 'a/.github/workflows/release.yml' +++ b/.github/workflows/release.yml @@ -1,42 +1,60 @@ name: Release + on: - push: - tags: - - '*' + workflow_run: + workflows: ["Build Windows"] + types: + - completed jobs: build: - name: Build - runs-on: ubuntu-latest - + runs-on: ubuntu-20.04 steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup Java 11 - uses: actions/setup-java@v1 + - name: Download VERSION + uses: dawidd6/action-download-artifact@v2 with: - java-version: 11 - - - name: Configure GIT + workflow: init.yml + name: version + - name: Add Version to environment run: | - git config user.name "${{ github.event.head_commit.committer.name }}" - git config user.email "${{ github.event.head_commit.committer.email }}" - - - name: Release artifacts - run: | - mvn deploy -DskipTests=true -B -U -Prelease + echo "VERSION=$(> $GITHUB_ENV + - name: Download windows exe + uses: dawidd6/action-download-artifact@v2 with: - server-id: ossrh - server-username: ${{ secrets.SONATYPE_USERNAME }} - server-password: ${{ secrets.SONATYPE_PASSWORD }} - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} - - - name: Update new version - run: | - TAG=${GITHUB_REF/refs\/tags\//} - newVersion=${TAG%.*}.$((${TAG##*.} + 1)) - mvn versions:set -DnewVersion=$newVersion-SNAPSHOT -DgenerateBackupPoms=false - git commit pom.xml -m "Prepare development of $newVersion" - git push https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY} HEAD:master \ No newline at end of file + workflow: windows.yml + name: windows-exe + path: target/install + - name: Download linux deb + uses: dawidd6/action-download-artifact@v2 + with: + workflow: linux.yml + name: linux-deb + path: target/install + - name: Download linux zip + uses: dawidd6/action-download-artifact@v2 + with: + workflow: linux.yml + name: linux-zip + path: target/install + - name: Download MacOS dmg + uses: dawidd6/action-download-artifact@v2 + with: + workflow: macos.yml + name: macos-dmg + path: target/install + - name: Delete old release if exists + uses: dev-drprasad/delete-tag-and-release@v0.2.0 + continue-on-error: true + with: + delete_release: true + tag_name: ${{ env.VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Release nightly build + uses: ncipollo/release-action@v1.8.6 + with: + allowUpdates: true + name: Stream-Pi-Server ${{ env.VERSION }} + artifacts: target/install/* + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.VERSION }} --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,52 @@ +name: Build Windows +on: + workflow_run: + workflows: ["Build MacOS"] + types: + - completed + +jobs: + build: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - name: Setup java + uses: joschi/setup-jdk@v2 + with: + java-version: 16 + - name: Download REQ_MODULES + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: req_modules + - name: Download VERSION + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: version + - name: Setup JavaFX + run: | + bitsadmin /Transfer DownsdfloadJavaFX https://download2.gluonhq.com/openjfx/17/openjfx-17-ea+11_linux-x64_bin-jmods.zip D:\openjfx-17-ea+11_linux-x64_bin-jmods.zip + Expand-Archive -Force D:\openjfx-17-ea+11_linux-x64_bin-jmods.zip D:\ + - name: Download built jars + uses: dawidd6/action-download-artifact@v2 + with: + workflow: init.yml + name: built-jars + path: target/lib/ + - name: Create Bundle using JPackage + id: project + shell: cmd + run: | + call .github\scripts\jpackage.bat + env: + MAIN_CLASS: com.stream_pi.client.Main + JAVAFX_JMODS: D:\javafx-jmods-17\ + JPACKAGE_HOME: ${{ env.JAVA_HOME }} + INSTALL_DIR: target/install + - name: Saving Windows x64 EXE + uses: actions/upload-artifact@v2 + with: + name: windows-exe + path: target/install/*.exe + Binary files /dev/null and b/assets/linux-icon.png differ Binary files /dev/null and b/assets/macos-icon.icns differ Binary files /dev/null and b/assets/windows-icon.ico differ --- 'a/pom.xml' +++ b/pom.xml @@ -35,6 +35,7 @@ 0.0.6 3.0.0-M5 + 2.3.1 @@ -140,6 +141,32 @@ + maven-dependency-plugin + + + package + + copy-dependencies + + + target/lib + org.openjfx + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + ${jar.plugin} + + target/lib/ + + + + org.apache.maven.plugins maven-compiler-plugin 3.8.1