From 7c23f9bdaeb25f17952c9e15c5966ada46197ea5 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Sun, 19 Nov 2023 20:37:01 +0100 Subject: [PATCH] [#6] Workflows: Add workflow to build and deploy the installer --- .gitea/workflows/deploy.yaml | 55 ++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ Installer/Installer.wixproj | 4 +-- Installer/MainComponents.wxs | 2 +- Setup/Bundle.wxs | 39 +++++++++++++------------ Setup/Files/.gitkeep | 0 Setup/Setup.wixproj | 4 +-- 7 files changed, 83 insertions(+), 23 deletions(-) create mode 100644 .gitea/workflows/deploy.yaml create mode 100644 Setup/Files/.gitkeep diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..c0278f2 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,55 @@ +name: Deploy +on: + push: + tags: ["v[0-9]+.[0-9]+.[0-9]+"] +jobs: + deploy: + name: Build and Deploy + runs-on: windows-latest + permissions: + contents: write + steps: + - name: Set APP_VERSION variable from tag + shell: powershell + run: | + $APP_VERSION = $env:GITHUB_REF -replace '^refs/tags/v', '' + Add-Content -Path $env:GITHUB_ENV -Value "APP_VERSION=$APP_VERSION" + - name: Checkout repository + uses: actions/checkout@v4 + - name: Check version in project + shell: powershell + run: | + Select-String Elwig/Elwig.csproj -Pattern "" + $res = Select-String Elwig/Elwig.csproj -Pattern "${{ env.APP_VERSION }}" + if ($res -eq $null) { + exit 1 + } + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.1 + - name: Setup NuGet + uses: nuget/setup-nuget@v1 + - name: Restore NuGet packages + shell: powershell + run: $(& nuget restore Elwig.sln; $a=$lastexitcode) | findstr x*; exit $a + - name: Build Setup + shell: powershell + run: $(& msbuild -verbosity:quiet Setup/Setup.wixproj -property:Configuration=Release -property:Platform=x64; $a=$lastexitcode) | findstr x*; exit $a + - name: Rename artifact + shell: powershell + run: Move-Item Setup/bin/x64/Release/Elwig.exe Setup/bin/x64/Release/Elwig-${{ env.APP_VERSION }}.exe + - name: Create release + uses: akkuman/gitea-release-action@v1 + with: + name: Elwig ${{ env.APP_VERSION }} + files: |- + Setup/bin/x64/Release/Elwig-${{ env.APP_VERSION }}.exe + - name: Upload to website + shell: powershell + run: | + $content = [System.IO.File]::ReadAllBytes("Setup/bin/x64/Release/Elwig-${{ env.APP_VERSION }}.exe") + Invoke-WebRequest ` + -Uri "https://www.necronda.net/elwig/files/Elwig-${{ env.APP_VERSION }}.exe" ` + -Method PUT ` + -Body $content ` + -Headers @{ Authorization = "${{ secrets.API_AUTHORIZATION }}" } ` + -ContentType "application/octet-stream" diff --git a/.gitignore b/.gitignore index e4a3f8c..d05c040 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ bin/ .vs .idea Tests/Resources/Sql/Create.sql +*.exe +!WinziPrint.exe diff --git a/Installer/Installer.wixproj b/Installer/Installer.wixproj index 7cf5689..2c4f05a 100644 --- a/Installer/Installer.wixproj +++ b/Installer/Installer.wixproj @@ -25,8 +25,8 @@ - - + + diff --git a/Installer/MainComponents.wxs b/Installer/MainComponents.wxs index 0774fa7..cdd66a7 100644 --- a/Installer/MainComponents.wxs +++ b/Installer/MainComponents.wxs @@ -11,7 +11,7 @@ - + diff --git a/Setup/Bundle.wxs b/Setup/Bundle.wxs index 211b1ea..aa16fcc 100644 --- a/Setup/Bundle.wxs +++ b/Setup/Bundle.wxs @@ -1,25 +1,28 @@  - - - - - - - - + + + + + + + + - - - - - - + + - diff --git a/Setup/Files/.gitkeep b/Setup/Files/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Setup/Setup.wixproj b/Setup/Setup.wixproj index 1d63687..4252aa8 100644 --- a/Setup/Setup.wixproj +++ b/Setup/Setup.wixproj @@ -5,8 +5,8 @@ de-AT - - + + ElwigProjectDir=..\Elwig