From ed2ad56b7604e10d385bc5a3b410bd108b1d0842 Mon Sep 17 00:00:00 2001 From: OMGeeky <> Date: Tue, 18 Feb 2025 18:08:02 +0100 Subject: [PATCH] cleanup some packaging stuff --- .github/workflows/release.yml | 7 +++---- packaging/package.sh | 13 +++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d9b6a0..163641c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,8 @@ jobs: run: | echo "Reading version from file:" cat packaging/ATCS_latest - VERSION=$(cat packaging/ATCS_latest) + echo "" + VERSION=$(tr -d '[:space:]' < "packaging/ATCS_latest") echo "Processed version: $VERSION" echo "VERSION=$VERSION" >> $GITHUB_ENV echo "Environment variable set to: $VERSION" @@ -26,7 +27,7 @@ jobs: uses: actions/setup-java@v2 with: java-version: '11' - distribution: 'adopt' + distribution: 'temurin' - name: Build JAR shell: bash @@ -41,8 +42,6 @@ jobs: - name: Install NSIS uses: joncloud/makensis-action@v4 - env: - VERSION: ${{ env.VERSION }} with: script-file: packaging/Windows/ATCS_Installer.nsi arguments: /DVERSION="${{ env.VERSION }}" diff --git a/packaging/package.sh b/packaging/package.sh index 2d688fa..193fa39 100755 --- a/packaging/package.sh +++ b/packaging/package.sh @@ -29,7 +29,7 @@ EXTRA_SOURCE_DIRS=( "siphash-zackehh/src/main/java" ) -# --- Libraries to include (from IntelliJ artifact definition) --- +# --- Libraries to include --- LIBRARIES=( "AndorsTrainer_v0.1.5.jar" "bsh-2.0b4.jar" @@ -44,7 +44,7 @@ LIBRARIES=( # --- Get version --- echo "Getting version" -VERSION=$(cat "${VERSION_FILE}") +VERSION=$(tr -d '[:space:]' < "${VERSION_FILE}") echo "Got version ${VERSION}" # --- Prepare temporary directory --- @@ -62,7 +62,7 @@ done # --- Set ClassPath --- echo "Getting source files" -# Find all java files in source directories and compile them +# Find all java files in source directories SOURCE_FILES=$(find "${SOURCE_BASE_DIR}" "${EXTRA_SOURCE_DIRS[@]/#/${ATCS_SOURCE_DIR}/}" -name "*.java" -print) #echo "SourceFiles: ${SOURCE_FILES}" echo "" @@ -70,6 +70,8 @@ echo "" # --- Build Java classes --- echo 'Building java classes' +# shellcheck disable=SC2086 +# (we need word splitting here to pass multiple files) javac -cp "${TEMP_DIR}" -d "${TEMP_DIR}" ${SOURCE_FILES} if [ $? -ne 0 ]; then echo "Compilation failed. Please check errors above." @@ -114,7 +116,10 @@ else # Use zip command on Linux zip -r "ATCS_${VERSION}.zip" common/* # archive the 'common' folder which now contains the JAR and libs fi +if [ $? -ne 0 ]; then + echo "Archive creation failed." + exit 1 +fi echo "Created archive at ${PACKAGING_DIR}/ATCS_${VERSION}.zip" -cd "${PACKAGING_DIR}" || exit echo "Script finished."