Compare commits

..

1 Commits

4 changed files with 42 additions and 91 deletions

View File

@@ -1,61 +0,0 @@
name: Release Build
on:
release:
types: [created]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Install NSIS
uses: joncloud/makensis-action@v4
- name: Build JAR
shell: bash
run: |
cd ATCS/packaging
chmod +x package.sh
./package.sh -windows
- name: Create Installer
shell: bash
run: |
cd ATCS/packaging/Windows
makensis ATCS_Installer.nsi
- name: Get Version
id: get_version
shell: bash
run: |
VERSION=$(cat ATCS/packaging/ATCS_latest | sed 's/^v//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload ZIP to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./ATCS/packaging/ATCS_${{ env.VERSION }}.zip
asset_name: ATCS_${{ env.VERSION }}.zip
asset_content_type: application/zip
- name: Upload Installer to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./ATCS/packaging/Windows/ATCS_v${{ env.VERSION }}_Setup.exe
asset_name: ATCS_v${{ env.VERSION }}_Setup.exe
asset_content_type: application/octet-stream

View File

@@ -1,10 +1,9 @@
!include MUI2.nsh !include MUI2.nsh
!system 'for /f "delims=" %%a in ('type ..\ATCS_latest') do set "VERSION=%%a" && exit' !define VERSION "0.6.21"
!define VERSION "$%VERSION:~1%"
!define TRAINER_VERSION "0.1.5" !define TRAINER_VERSION "0.1.5"
!define JAVA_BIN "java" !define JAVA_BIN "java"
!define ATCS_SOURCE_DIR "..\..\" !define ATCS_SOURCE_DIR "C:\ATCS"
Name "Andor's Trail Content Studio v${VERSION}" Name "Andor's Trail Content Studio v${VERSION}"
OutFile "ATCS_v${VERSION}_Setup.exe" OutFile "ATCS_v${VERSION}_Setup.exe"

View File

@@ -21,6 +21,7 @@ MANIFEST_LOCATION="${PACKAGING_DIR}/Manifest.txt"
VERSION_FILE="${PACKAGING_DIR}/ATCS_latest" VERSION_FILE="${PACKAGING_DIR}/ATCS_latest"
SOURCE_BASE_DIR="${ATCS_SOURCE_DIR}/src" # Base directory for standard source code SOURCE_BASE_DIR="${ATCS_SOURCE_DIR}/src" # Base directory for standard source code
LIB_BASE_DIR="${ATCS_SOURCE_DIR}/lib" # Base directory for libraries LIB_BASE_DIR="${ATCS_SOURCE_DIR}/lib" # Base directory for libraries
OUTPUT_JAR_DIR="${PACKAGING_DIR}" # Directory where the final JAR will be placed - as per script
# --- **ADDITIONAL SOURCE CODE FOLDERS** --- # --- **ADDITIONAL SOURCE CODE FOLDERS** ---
EXTRA_SOURCE_DIRS=( EXTRA_SOURCE_DIRS=(
@@ -102,19 +103,17 @@ cd "${PACKAGING_DIR}" || exit # Go back to packaging dir
echo '' echo ''
echo "Done creating jar at ${JAR_LOCATION}" echo "Done creating jar at ${JAR_LOCATION}"
cp -f "${JAR_LOCATION}" "${PACKAGING_DIR}/common/ATCS.jar" # Copy JAR to versioned name cp -f "${JAR_LOCATION}" "${OUTPUT_JAR_DIR}/common/ATCS.jar" # Copy JAR to versioned name
# --- Create archive --- # --- Create archive ---
cd "${PACKAGING_DIR}" || exit if [ "$PLATFORM" = "LINUX" ]; then
echo "Creating archive" cd "${OUTPUT_JAR_DIR}" || exit
if [ "$PLATFORM" = "WINDOWS" ]; then echo "Creating archive"
# Use PowerShell's Compress-Archive which is available by default on Windows tar caf "ATCS_${VERSION}.tar.gz" common/* # archive the 'common' folder which now contains the JAR and libs
powershell.exe -Command "Compress-Archive -Path './common/*' -DestinationPath './ATCS_${VERSION}.zip' -Force" echo "Created archive at ${OUTPUT_JAR_DIR}/ATCS_${VERSION}.tar.gz"
cd "${PACKAGING_DIR}" || exit
else else
# Use zip command on Linux echo "Can't create zip files on windows yet. Please pack the content of the '${OUTPUT_JAR_DIR}/common/' folder yourself"
zip -r "ATCS_${VERSION}.zip" common/* # archive the 'common' folder which now contains the JAR and libs
fi fi
echo "Created archive at ${PACKAGING_DIR}/ATCS_${VERSION}.zip"
cd "${PACKAGING_DIR}" || exit
echo "Script finished." echo "Script finished."

View File

@@ -153,8 +153,7 @@ public class ATContentStudio {
while ((inputLine = in.readLine()) != null) { while ((inputLine = in.readLine()) != null) {
lastLine = inputLine; lastLine = inputLine;
} }
if (lastLine != null && !lastLine.equals(APP_VERSION)) { if (lastLine != null && compareVersions(lastLine) < 0) {
// for copying style // for copying style
JLabel label = new JLabel(); JLabel label = new JLabel();
Font font = label.getFont(); Font font = label.getFont();
@@ -231,4 +230,19 @@ public class ATContentStudio {
} }
} }
} }
/// returns The difference between the the latest version and the current one (CURRENT - LATEST)
private static int compareVersions(String latest) {
String[] levels1 = ATContentStudio.APP_VERSION.substring(1).split("\\.");
String[] levels2 = latest.substring(1).split("\\.");
int length = Math.max(levels1.length, levels2.length);
for (int i = 0; i < length; i++) {
int v1 = i < levels1.length ? Integer.parseInt(levels1[i]) : 0;
int v2 = i < levels2.length ? Integer.parseInt(levels2[i]) : 0;
if (v1 != v2) {
return v1 - v2;
}
}
return 0;
}
} }