From f6fd520d2a0342c94560902e8f707e7ef090e5fe Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 17 Jan 2024 20:42:59 +0000 Subject: [PATCH] [appstore] prevent packaging of ALPHA or BETA versions * Also add package version override --- .github/workflows/mingw.yml | 8 ++++++-- .github/workflows/vs2022.yml | 8 ++++++-- res/appstore/packme.cmd | 35 +++++++++++++++++++++++++++++------ src/rufus.rc | 10 +++++----- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 39779c9c..1f2e02bb 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -63,14 +63,18 @@ jobs: shell: bash if: ${{ !startsWith(github.ref, 'refs/tags/') }} # This ONLY works if the shell is bash or if using $env:GITHUB_OUTPUT - run: echo "option=--enable-alpha" >> $GITHUB_OUTPUT + run: | + echo "option=--enable-alpha" >> $GITHUB_OUTPUT + sed -b -i 's/VALUE "InternalName", "Rufus"/VALUE "InternalName", "Rufus (ALPHA)"/' ./src/rufus.rc - name: Set BETA id: set_beta shell: bash if: ${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'BETA') }} # This ONLY works if the shell is bash or if using $env:GITHUB_OUTPUT - run: echo "option=--enable-beta" >> $GITHUB_OUTPUT + run: | + echo "option=--enable-beta" >> $GITHUB_OUTPUT + sed -b -i 's/VALUE "InternalName", "Rufus"/VALUE "InternalName", "Rufus (BETA)"/' ./src/rufus.rc - name: Build run: | diff --git a/.github/workflows/vs2022.yml b/.github/workflows/vs2022.yml index 82ac2bde..b82a70b2 100644 --- a/.github/workflows/vs2022.yml +++ b/.github/workflows/vs2022.yml @@ -54,14 +54,18 @@ jobs: shell: bash if: ${{ !startsWith(github.ref, 'refs/tags/') }} # This ONLY works if the shell is bash or if using $env:GITHUB_OUTPUT - run: echo "option=/DALPHA" >> $GITHUB_OUTPUT + run: | + echo "option=/DALPHA" >> $GITHUB_OUTPUT + sed -b -i 's/VALUE "InternalName", "Rufus"/VALUE "InternalName", "Rufus (ALPHA)"/' ./src/rufus.rc - name: Set BETA id: set_beta shell: bash if: ${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'BETA') }} # This ONLY works if the shell is bash or if using $env:GITHUB_OUTPUT - run: echo "option=/DBETA" >> $GITHUB_OUTPUT + run: | + echo "option=/DBETA" >> $GITHUB_OUTPUT + sed -b -i 's/VALUE "InternalName", "Rufus"/VALUE "InternalName", "Rufus (BETA)"/' ./src/rufus.rc - name: Build shell: cmd diff --git a/res/appstore/packme.cmd b/res/appstore/packme.cmd index 095eacd9..1ecd6f19 100644 --- a/res/appstore/packme.cmd +++ b/res/appstore/packme.cmd @@ -3,6 +3,9 @@ @echo off setlocal EnableExtensions DisableDelayedExpansion +rem if set, this will override the version for the package +rem set VERSION_OVERRIDE=4.4.2104.0 + goto main :ReplaceTokenInFile @@ -66,13 +69,33 @@ for %%a in (%ARCHS%) do ( ) ) +rem exiftool.exe can't be installed in the Windows system directories... +if not exist exiftool.exe ( + echo exiftool.exe must exist in this directory + goto out +) + +rem Make sure we're not trying to create a package from an ALPHA or BETA version! +exiftool -s3 -*InternalName* rufus_x64.exe | findstr /C:"ALPHA" 1>nul && ( + echo Alpha version detected - ABORTED + goto out +) +exiftool -s3 -*InternalName* rufus_x64.exe | findstr /C:"BETA" 1>nul && ( + echo Beta version detected - ABORTED + goto out +) + rem Populate the version from the executable -set target=%~dp0rufus_x64.exe -set target=%target:\=\\% -wmic datafile where "name='%target%'" get version | find /v "Version" > version.txt -set /p VERSION= version.txt + set /p VERSION=