Merge pull request #1 from OMGeeky/package-improvements

Package improvements
This commit is contained in:
OMGeeky
2025-02-16 00:27:35 +01:00
committed by GitHub
3 changed files with 89 additions and 26 deletions

61
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
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,9 +1,10 @@
!include MUI2.nsh
!define VERSION "0.6.21"
!system 'for /f "delims=" %%a in ('type ..\ATCS_latest') do set "VERSION=%%a" && exit'
!define VERSION "$%VERSION:~1%"
!define TRAINER_VERSION "0.1.5"
!define JAVA_BIN "java"
!define ATCS_SOURCE_DIR "C:\ATCS"
!define ATCS_SOURCE_DIR "..\..\"
Name "Andor's Trail Content Studio v${VERSION}"
OutFile "ATCS_v${VERSION}_Setup.exe"
@@ -86,23 +87,23 @@ Section install
FileClose $9
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN "ATCS"
;--- Create shortcuts
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Andor's Trail Content Studio.lnk" "$INSTDIR\ATCS.cmd" "" "$INSTDIR\ATCS.ico"
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;------------------------------------------------------------------------------------
Section uninstall
Delete "$INSTDIR\lib\jide-oss.jar"
Delete "$INSTDIR\lib\ui.jar"
Delete "$INSTDIR\lib\junit-4.10.jar"
@@ -120,13 +121,13 @@ Section uninstall
Delete "$INSTDIR\ATCS.jar"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER "ATCS" $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\Andor's Trail Content Studio.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
SectionEnd
@@ -138,28 +139,28 @@ Function GetJRE
; 2 - in JAVA_HOME environment variable
; 3 - in the registry
; 4 - assume java.exe in current dir or PATH
Push $R0
Push $R1
;ClearErrors
;StrCpy $R0 "$EXEDIR\jre\bin\java.exe"
;IfFileExists $R0 JreFound
;StrCpy $R0 ""
ClearErrors
ReadEnvStr $R0 "JAVA_HOME"
StrCpy $R0 "$R0\bin\${JAVA_BIN}.exe"
IfErrors 0 JreFound
ClearErrors
ReadRegStr $R1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
ReadRegStr $R0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$R1" "JavaHome"
StrCpy $R0 "$R0\bin\${JAVA_BIN}.exe"
IfErrors 0 JreFound
StrCpy $R0 "${JAVA_BIN}.exe"
JreFound:
Pop $R1
Exch $R0

View File

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