handle errors during nsis exe creation and only upload zip in those cases

This commit is contained in:
OMGeeky
2025-10-02 16:46:08 +02:00
parent be040a74bd
commit 79eddde155

View File

@@ -2,55 +2,67 @@ name: Release Build
on: on:
release: release:
types: [created] types: [ created ]
workflow_dispatch:
jobs: jobs:
build: build:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Get Version - name: Get Version
id: get_version id: get_version
shell: bash shell: bash
run: | run: |
echo "Reading version from file:" echo "Reading version from file:"
cat res/ATCS_latest cat res/ATCS_latest
echo "" echo ""
VERSION=$(tr -d '[:space:]' < "res/ATCS_latest") VERSION=$(tr -d '[:space:]' < "res/ATCS_latest")
echo "Processed version: $VERSION" echo "Processed version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Environment variable set to: $VERSION" echo "Environment variable set to: $VERSION"
- name: Set up JDK - name: Set up JDK
uses: actions/setup-java@v2 uses: actions/setup-java@v2
with: with:
java-version: '11' java-version: '11'
distribution: 'temurin' distribution: 'temurin'
- name: Build JAR - name: Build JAR
shell: bash shell: bash
run: | run: |
cd packaging cd packaging
chmod +x package.sh chmod +x package.sh
echo "Building JAR and ZIP for version: ${{ env.VERSION }}" echo "Building JAR and ZIP for version: ${{ env.VERSION }}"
./package.sh -windows ./package.sh -windows
echo "Created artifacts:" echo "Created artifacts:"
ls -la common/ATCS.jar ls -la common/ATCS.jar
ls -la ATCS_${{ env.VERSION }}.zip ls -la ATCS_${{ env.VERSION }}.zip
- name: Install NSIS - name: Install NSIS
uses: joncloud/makensis-action@v4 uses: joncloud/makensis-action@v4
with: with:
script-file: packaging/Windows/ATCS_Installer.nsi script-file: packaging/Windows/ATCS_Installer.nsi
arguments: /DVERSION="${{ env.VERSION }}" arguments: /DVERSION="${{ env.VERSION }}"
continue-on-error: true
- name: Upload Release Assets - name: Determine Upload Files
uses: softprops/action-gh-release@v1 id: upload_files
env: shell: bash
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: |
with: FILES="./packaging/ATCS_${VERSION}.zip"
files: | if [ -f "./packaging/ATCS_${VERSION}_Setup.exe" ]; then
./packaging/ATCS_${{ env.VERSION }}.zip FILES="$FILES ./packaging/ATCS_${VERSION}_Setup.exe"
./packaging/ATCS_${{ env.VERSION }}_Setup.exe else
run: echo "::warning::exe-installer created by NSIS was not found; only ZIP will be uploaded."
fi
echo "files=$FILES" >> $GITHUB_OUTPUT
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.upload_files.outputs.files }}