From 2b03bab7dc625b3ba4cd38bf42aa06f03f1020f7 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Wed, 22 Feb 2023 14:57:58 +0000 Subject: [PATCH] Deb package - fix version number --- .github/workflows/linux-package.yml | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-package.yml b/.github/workflows/linux-package.yml index 376c5ae61..c7d41d971 100644 --- a/.github/workflows/linux-package.yml +++ b/.github/workflows/linux-package.yml @@ -7,7 +7,30 @@ on: - feature/linux-ci jobs: + version: + runs-on: ubuntu-latest + outputs: + version-number: ${{ steps.get-version.outputs.version-number }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Get Version String + id: get-version + shell: pwsh + run: | + $MidnightUtc = [DateTime]::UtcNow.Date + $BranchName = "${{ github.ref_name }}".replace('/','-').replace('.','-') + $ApiVersion = (Select-Xml -Path 'src/Artemis.Core/Artemis.Core.csproj' -XPath '//PluginApiVersion').Node.InnerText + $NumberOfCommitsToday = (git log --after=$($MidnightUtc.ToString("o")) --oneline | Measure-Object -Line).Lines + $VersionNumber = "$ApiVersion.$($MidnightUtc.ToString("yyyy.MMdd")).$NumberOfCommitsToday" + # If we're not in master, add the branch name to the version so it counts as prerelease + if ($BranchName -ne "master") { $VersionNumber += "-$BranchName" } + "version-number=$VersionNumber" >> $Env:GITHUB_OUTPUT + package: + needs: version name: Package deb runs-on: ubuntu-latest steps: @@ -27,7 +50,7 @@ jobs: - name: Install dotnet deb run: dotnet tool install --global dotnet-deb - name: Publish Artemis - run: dotnet publish --configuration Release --runtime linux-x64 --self-contained Artemis/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj + run: dotnet publish --configuration Release -p:Version=${{ needs.version.outputs.version-number }} --runtime linux-x64 --self-contained Artemis/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj - name: Publish Plugins run: | New-Item -ItemType "Directory" -Path Artemis/src/Artemis.UI.Linux/bin/linux-x64/publish/Plugins @@ -42,5 +65,5 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v3 with: - name: Artemis.UI.Linux.1.0.0.linux-x64.deb - path: Artemis/src/Artemis.UI.Linux/bin/linux-x64/Artemis.UI.Linux.1.0.0.linux-x64.deb \ No newline at end of file + name: artemis-linux-x64-${{ needs.version.outputs.version-number }}.deb + path: Artemis/src/Artemis.UI.Linux/bin/linux-x64/Artemis.UI.Linux.${{ needs.version.outputs.version-number }}.linux-x64.deb \ No newline at end of file