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