-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI-build the updater correctly this time.
:)
- Loading branch information
Showing
7 changed files
with
134 additions
and
117 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Java CI with Maven | ||
|
||
on: | ||
|
@@ -15,40 +7,100 @@ on: | |
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
build_windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
- name: 📩 Set up JDK 11 | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🏗️ Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "11" | ||
distribution: "temurin" | ||
java-version: 11 | ||
distribution: temurin | ||
cache: maven | ||
|
||
- name: Compile the updater. | ||
- name: 🔨 Compile the updater | ||
run: bash build.sh compile | ||
|
||
- name: Build the Windows artifact. | ||
- name: 📦 Build the Windows artifact | ||
run: bash build.sh dist-windows | ||
- name: Upload the Windows artifact. | ||
|
||
- name: 🆙 Upload the Windows artifact (x86_64) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Casterlabs-Caffeinated-Windows.zip | ||
path: dist/artifacts/Windows.zip | ||
name: Casterlabs-Caffeinated-windows-x86_64.zip | ||
path: dist/artifacts/Casterlabs-Caffeinated-windows-x86_64.zip | ||
|
||
- name: Create installer | ||
uses: joncloud/[email protected] | ||
with: | ||
script-file: "Installer.nsi" | ||
|
||
- name: Build the Linux artifact. | ||
build_macos: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📩 Set up JDK 11 | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🏗️ Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 11 | ||
distribution: temurin | ||
cache: maven | ||
|
||
- name: 🔨 Compile the updater | ||
run: bash build.sh compile | ||
|
||
- name: 📦 Build the macOS artifact | ||
run: bash build.sh dist-macos | ||
|
||
- name: 🆙 Upload the macOS artifact (aarch64) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Casterlabs-Caffeinated-macos-aarch64.tar.gz | ||
path: dist/artifacts/Casterlabs-Caffeinated-macos-aarch64.tar.gz | ||
|
||
- name: 🆙 Upload the macOS artifact (x86_64) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Casterlabs-Caffeinated-macos-x86_64.tar.gz | ||
path: dist/artifacts/Casterlabs-Caffeinated-macos-x86_64.tar.gz | ||
|
||
build_linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📩 Set up JDK 11 | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🏗️ Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 11 | ||
distribution: temurin | ||
cache: maven | ||
|
||
- name: 🔨 Compile the updater | ||
run: bash build.sh compile | ||
|
||
- name: 📦 Build the Linux artifact | ||
run: bash build.sh dist-linux | ||
- name: Upload the Linux artifact. | ||
|
||
- name: 🆙 Upload the Linux artifact (aarch64) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Casterlabs-Caffeinated-Linux.tar.gz | ||
path: dist/artifacts/Linux.tar.gz | ||
name: Casterlabs-Caffeinated-gnulinux-aarch64.tar.gz | ||
path: dist/artifacts/Casterlabs-Caffeinated-gnulinux-aarch64.tar.gz | ||
|
||
- name: Build the macOS artifact. | ||
run: bash build.sh dist-macos | ||
- name: Upload the macOS artifact. | ||
- name: 🆙 Upload the Linux artifact (arm) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Casterlabs-Caffeinated-gnulinux-arm.tar.gz | ||
path: dist/artifacts/Casterlabs-Caffeinated-gnulinux-arm.tar.gz | ||
|
||
- name: 🆙 Upload the Linux artifact (x86_64) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Casterlabs-Caffeinated-macOS.tar.gz | ||
path: dist/artifacts/macOS.tar.gz | ||
name: Casterlabs-Caffeinated-gnulinux-x86_64.tar.gz | ||
path: dist/artifacts/Casterlabs-Caffeinated-gnulinux-x86_64.tar.gz |
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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,62 @@ | ||
#!/bin/bash | ||
|
||
JRE_DOWNLOAD_URL__WINDOWS="https://api.adoptium.net/v3/binary/latest/11/ga/windows/x64/jre/hotspot/normal/eclipse?project=jdk" | ||
JRE_DOWNLOAD_URL__LINUX="https://api.adoptium.net/v3/binary/latest/11/ga/linux/x64/jre/hotspot/normal/eclipse?project=jdk" | ||
JRE_DOWNLOAD_URL__MACOS="https://api.adoptium.net/v3/binary/latest/11/ga/mac/x64/jre/hotspot/normal/eclipse?project=jdk" | ||
set -e -o pipefail | ||
|
||
APP_ID="co.casterlabs.caffeinated" | ||
APP_NAME="Casterlabs-Caffeinated" | ||
MAIN_CLASS="co.casterlabs.caffeinated.updater.Launcher" | ||
|
||
# Compile everything | ||
if [[ $@ == *"compile"* ]]; then | ||
echo "------------ Compiling app ------------" | ||
mvn clean package | ||
echo "------------ Finishing compiling app ---------" | ||
fi | ||
|
||
# Reset the dist folder | ||
rm -rf dist/* | ||
mkdir -p dist | ||
mkdir dist/artifacts | ||
|
||
if [[ $@ == *"dist-windows"* ]]; then | ||
echo "Building for Windows..." | ||
mkdir dist/windows | ||
|
||
if [ ! -f windows_runtime.zip ]; then | ||
echo "Downloading JRE from ${JRE_DOWNLOAD_URL__WINDOWS}." | ||
wget -O windows_runtime.zip $JRE_DOWNLOAD_URL__WINDOWS | ||
fi | ||
|
||
java -jar "packr.jar" \ | ||
--platform windows64 \ | ||
--jdk windows_runtime.zip \ | ||
--executable Casterlabs-Caffeinated-Updater \ | ||
--classpath target/Casterlabs-Caffeinated-Updater.jar \ | ||
--mainclass $MAIN_CLASS \ | ||
--vmargs caffeinated.channel=stable \ | ||
--output dist/windows | ||
|
||
echo "Finished building for Windows." | ||
|
||
cd dist/windows | ||
zip -r ../artifacts/Windows.zip * | ||
cd - # Return. | ||
echo "" | ||
fi | ||
echo "------------ Bundling for Windows ------------" | ||
|
||
if [[ $@ == *"dist-linux"* ]]; then | ||
echo "Building for Linux..." | ||
mkdir dist/linux | ||
|
||
if [ ! -f linux_runtime.tar.gz ]; then | ||
echo "Downloading JRE from ${JRE_DOWNLOAD_URL__LINUX}." | ||
wget -O linux_runtime.tar.gz $JRE_DOWNLOAD_URL__LINUX | ||
fi | ||
|
||
java -jar "packr.jar" \ | ||
--platform linux64 \ | ||
--jdk linux_runtime.tar.gz \ | ||
--executable Casterlabs-Caffeinated-Updater \ | ||
--classpath target/Casterlabs-Caffeinated-Updater.jar \ | ||
--mainclass $MAIN_CLASS \ | ||
--vmargs caffeinated.channel=stable \ | ||
--output dist/linux | ||
|
||
echo "Finished building for Linux." | ||
|
||
cd dist/linux | ||
tar -czvf ../artifacts/Linux.tar.gz * | ||
cd - # Return. | ||
echo "" | ||
java -jar bundler.jar bundle \ | ||
--arch x86_64 --os windows \ | ||
--id $APP_ID --name $APP_NAME --icon icon.png \ | ||
--java 11 --dependency target/Casterlabs-Caffeinated-Updater.jar --main $MAIN_CLASS | ||
|
||
echo "------------ Finished bundling for Windows ------------" | ||
fi | ||
|
||
if [[ $@ == *"dist-macos"* ]]; then | ||
echo "Building for MacOS..." | ||
mkdir dist/macos | ||
mkdir dist/macos/Casterlabs-Caffeinated.app | ||
|
||
if [ ! -f macos_runtime.tar.gz ]; then | ||
echo "Downloading JRE from ${JRE_DOWNLOAD_URL__MACOS}." | ||
wget -O macos_runtime.tar.gz $JRE_DOWNLOAD_URL__MACOS | ||
fi | ||
|
||
java -jar "packr.jar" \ | ||
--platform mac \ | ||
--jdk macos_runtime.tar.gz \ | ||
--executable Casterlabs-Caffeinated-Updater \ | ||
--icon app_icon.icns \ | ||
--bundle co.casterlabs.caffeinated \ | ||
--classpath target/Casterlabs-Caffeinated-Updater.jar \ | ||
--mainclass $MAIN_CLASS \ | ||
--vmargs caffeinated.channel=stable \ | ||
--output dist/macos/Casterlabs-Caffeinated.app | ||
|
||
echo "Finished building for MacOS." | ||
|
||
cd dist/macos | ||
tar -czvf ../artifacts/macOS.tar.gz * | ||
cd - # Return. | ||
echo "" | ||
echo "------------ Bundling for macOS ------------" | ||
|
||
java -jar bundler.jar bundle \ | ||
--arch aarch64 --os macos \ | ||
--id $APP_ID --name $APP_NAME --icon icon.png \ | ||
--java 11 --dependency target/Casterlabs-Caffeinated-Updater.jar --main $MAIN_CLASS | ||
|
||
java -jar bundler.jar bundle \ | ||
--arch x86_64 --os macos \ | ||
--id $APP_ID --name $APP_NAME --icon icon.png \ | ||
--java 11 --dependency target/Casterlabs-Caffeinated-Updater.jar --main $MAIN_CLASS | ||
|
||
echo "------------ Finished bundling for macOS ------------" | ||
fi | ||
|
||
if [[ $@ == *"dist-linux"* ]]; then | ||
echo "------------ Bundling for Linux ------------" | ||
|
||
java -jar bundler.jar bundle \ | ||
--arch aarch64 --os gnulinux \ | ||
--id $APP_ID --name $APP_NAME --icon icon.png \ | ||
--java 11 --dependency target/Casterlabs-Caffeinated-Updater.jar --main $MAIN_CLASS | ||
|
||
java -jar bundler.jar bundle \ | ||
--arch arm --os gnulinux \ | ||
--id $APP_ID --name $APP_NAME --icon icon.png \ | ||
--java 11 --dependency target/Casterlabs-Caffeinated-Updater.jar --main $MAIN_CLASS | ||
|
||
java -jar bundler.jar bundle \ | ||
--arch x86_64 --os gnulinux \ | ||
--id $APP_ID --name $APP_NAME --icon icon.png \ | ||
--java 11 --dependency target/Casterlabs-Caffeinated-Updater.jar --main $MAIN_CLASS | ||
|
||
echo "------------ Finished bundling for Linux ------------" | ||
fi | ||
|
Binary file not shown.