From 7a017197a8f8bf4b1b47149a0b1cca8c999e2008 Mon Sep 17 00:00:00 2001 From: Iain Cardnell Date: Thu, 21 Sep 2023 20:34:35 +0100 Subject: [PATCH] build: convert windows build to powershell --- .github/workflows/ci.yml | 6 ++---- build-windows.cmd | 10 ---------- build-windows.ps1 | 12 ++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 build-windows.cmd create mode 100644 build-windows.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 199611c..95cc45f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,10 +34,8 @@ jobs: components: 'native-image' # github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - - name: Build with SBT - run: sbt assembly - - name: Generate native image - run: build-windows.cmd + - name: Build + run: .\build-windows.ps1 - name: Upload binary uses: actions/upload-artifact@v2 with: diff --git a/build-windows.cmd b/build-windows.cmd deleted file mode 100644 index f733573..0000000 --- a/build-windows.cmd +++ /dev/null @@ -1,10 +0,0 @@ -call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" -FOR /F %%i IN ('git mkver next') DO set VERSION=%%i -call sbt assembly -cd target\scala-2.12 -call native-image -jar git-mkver-assembly-%VERSION%.jar --no-fallback -del git-mkver.exe -move git-mkver-assembly-%VERSION%.exe git-mkver.exe -PowerShell -Command "Compress-Archive -Path 'git-mkver.exe' -DestinationPath 'git-mkver-windows-amd64-%VERSION%.zip'" -PowerShell -Command "Get-FileHash git-mkver-windows-amd64-%VERSION%.zip | %% Hash" -cd ..\..\ diff --git a/build-windows.ps1 b/build-windows.ps1 new file mode 100644 index 0000000..25806b2 --- /dev/null +++ b/build-windows.ps1 @@ -0,0 +1,12 @@ +# & "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" + +# Get the version from the git command +& sbt -error -batch "run -c git-mkver.conf patch" +$VERSION = & sbt -error -batch "run -c git-mkver.conf next" + +& sbt assembly +Set-Location -Path target\scala-2.12 +& native-image -jar "git-mkver-assembly-$VERSION.jar" --no-fallback +Move-Item -Path "git-mkver-assembly-$VERSION.exe" -Destination git-mkver.exe +Compress-Archive -Path 'git-mkver.exe' -DestinationPath 'git-mkver-windows-amd64-%VERSION%.zip' +Get-FileHash git-mkver-windows-amd64-%VERSION%.zip | %% Hash