Use powershell instead of sed
This commit is contained in:
parent
ed531ec289
commit
89de623d87
|
|
@ -34,30 +34,34 @@ jobs:
|
|||
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
||||
|
||||
- name: Set version for Windows build
|
||||
if: matrix.platform == 'windows-latest'
|
||||
shell: pwsh # Use PowerShell on Windows runners
|
||||
run: |
|
||||
# Get the version from the Git tag (e.g., v0.6.3-alpha)
|
||||
VERSION=$(echo ${GITHUB_REF#refs/tags/})
|
||||
|
||||
$VERSION = ${GITHUB_REF.Substring('refs/tags/'.Length)}
|
||||
|
||||
# Replace '-alpha' with '-0' and '-beta' with '-1' only for Windows version
|
||||
if [[ $VERSION == *"-alpha"* ]]; then
|
||||
WINDOWS_VERSION=${VERSION%-alpha}-0
|
||||
elif [[ $VERSION == *"-beta"* ]]; then
|
||||
WINDOWS_VERSION=${VERSION%-beta}-1
|
||||
else
|
||||
WINDOWS_VERSION=$VERSION # Keep the same version for non-alpha/beta tags
|
||||
fi
|
||||
|
||||
if ($VERSION -match "-alpha") {
|
||||
$WINDOWS_VERSION = $VERSION -replace "-alpha$", "-0"
|
||||
} elseif ($VERSION -match "-beta") {
|
||||
$WINDOWS_VERSION = $VERSION -replace "-beta$", "-1"
|
||||
} else {
|
||||
$WINDOWS_VERSION = $VERSION
|
||||
}
|
||||
|
||||
# Copy tauri.conf.json to tauri.windows.conf.json and substitute version number for Windows
|
||||
cp src-tauri/tauri.conf.json src-tauri/tauri.windows.conf.json
|
||||
|
||||
sed -i "s|\"version\": \".*\"|\"version\": \"${WINDOWS_VERSION}\"|" src-tauri/tauri.windows.conf.json
|
||||
shell: bash
|
||||
Copy-Item src-tauri/tauri.conf.json -Destination src-tauri/tauri.windows.conf.json
|
||||
(Get-Content src-tauri/tauri.windows.conf.json) | ForEach-Object { $_ -replace '"version": ".*"', '"version": "' + $WINDOWS_VERSION + '"' } | Set-Content src-tauri/tauri.windows.conf.json
|
||||
|
||||
# Export the Windows version for use in subsequent steps
|
||||
echo "WINDOWS_VERSION=$WINDOWS_VERSION" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Set version for all platforms
|
||||
run: |
|
||||
# Extract the version from the Git tag (it should be the same across platforms)
|
||||
VERSION=$(echo ${GITHUB_REF#refs/tags/})
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
if: matrix.platform != 'windows-latest'
|
||||
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
|
|
|
|||
Loading…
Reference in New Issue