From d006fa87abe190d9f6194ddba83eea57b93f2de9 Mon Sep 17 00:00:00 2001 From: Raymond Lynch Date: Fri, 9 Apr 2021 14:53:06 -0400 Subject: [PATCH] Staging update action --- .github/workflows/main.yml | 54 +++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d56524c98..898b6f41e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,13 +6,13 @@ jobs: name: Build on Windows runs-on: windows-2019 steps: - - uses: actions/checkout@v1 - - name: Initialize Submodules - run: git submodule update --init --recursive + - uses: actions/checkout@v2 + with: + submodules: recursive - name: Setup Nuget uses: nuget/setup-nuget@v1 with: - nuget-version: 'latest' + nuget-version: latest - name: Restore Nuget Packages run: nuget restore Dalamud.sln - name: Define VERSION @@ -27,12 +27,54 @@ jobs: - name: Build DotNet4 run: | cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\" - .\MSBuild.exe $Env:GITHUB_WORKSPACE\Dalamud.sln /t:Build /p:Configuration=Release /p:DefineConstants=XL_NOAUTOUPDATE + .\MSBuild.exe $Env:GITHUB_WORKSPACE\Dalamud.sln /t:Build /p:Configuration=Release /p:DefineConstants=XL_NOAUTOUPDATE - name: Run xUnit Tests run: | ${{github.workspace}}\packages\xunit.runner.console.2.4.1\tools\net472\xunit.console.exe ${{github.workspace}}\Dalamud.Test\bin\Release\Dalamud.Test.dll - name: Upload artifact - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v2 with: name: dalamud-artifact path: bin\ + + deploy_stg: + name: Deploy dalamud-distrib staging + if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }} + needs: build + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + repository: daemitus/dalamud-distrib + token: ${{ secrets.PAT }} + - uses: actions/download-artifact@v2 + with: + name: dalamud-artifact + path: .\scratch + - name: Generate dalamud-distrib version file + shell: powershell + run: | + Compress-Archive .\scratch\* .\canary.zip # Recreate the release zip + + $dllBytes = [System.IO.File]::ReadAllBytes("$(Get-Location)\scratch\Dalamud.dll") + $assembly = [System.Reflection.Assembly]::Load($dllBytes) + $newVersion = $assembly.GetName().Version.ToString() + Remove-Item -Force -Recurse .\scratch + + $versionData = Get-Content .\stg\version | ConvertFrom-Json + $oldVersion = $versionData.AssemblyVersion + if ($oldVersion -eq $newVersion) { + Remove-Item .\canary.zip + } else { + Move-Item -Force .\canary.zip .\stg\latest.zip + $versionData.AssemblyVersion = $newVersion + $versionData | ConvertTo-Json -Compress | Out-File .\stg\version + } + - name: Commit changes + uses: EndBug/add-and-commit@v7 + with: + add: --all + author_name: GitHub Action + author_email: github-actions[bot]@users.noreply.github.com + message: Update staging + branch: main