From 4c1532db8090bcd1f2718bd8a8c259fd3bad657b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Pucha=C5=82a?= Date: Tue, 9 Jul 2024 21:34:28 +0200 Subject: [PATCH] chore: Rename workflow file to ci.yml and split to ci and publish parts (#59) Split workflow file into ci and publish parts. --- .github/workflows/{dotnetcore.yml => ci.yml} | 18 ++---------- .github/workflows/publish.yml | 31 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 15 deletions(-) rename .github/workflows/{dotnetcore.yml => ci.yml} (83%) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/ci.yml similarity index 83% rename from .github/workflows/dotnetcore.yml rename to .github/workflows/ci.yml index 9efdd11d..29156e2d 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,9 @@ -name: Publish +name: CI on: push: + branches: + - '**' paths-ignore: - 'badges/**' @@ -95,17 +97,3 @@ jobs: else echo "No changes to commit" fi - - name: Publish - if: github.ref == 'refs/heads/master' - run: | - $scriptLocationDirectory=(Get-Location).ToString() - $scriptLocationFilePath=[System.IO.Path]::Combine($scriptLocationDirectory, "Publish.Nuget.ps1") - $nugetExecutable=[System.IO.Path]::Combine($scriptLocationDirectory, "nuget", "nuget.exe") - $projects = @('Musoq.Converter', 'Musoq.Evaluator', 'Musoq.Parser', 'Musoq.Plugins', 'Musoq.Schema') - - foreach ($project in $projects) { - pushd - cd "./$project/bin/Release" - Invoke-Expression "$scriptLocationFilePath $nugetExecutable $project '${{ secrets.nuget_musoq_key }}'" - popd - } diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..9365631e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +name: Publish + +on: + workflow_dispatch: + + workflow_run: + workflows: ["CI"] + types: + - completed + +jobs: + publish: + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + with: + dotnet-version: '8.0.x' + - name: Publish + run: | + $scriptLocationDirectory=(Get-Location).ToString() + $scriptLocationFilePath=[System.IO.Path]::Combine($scriptLocationDirectory, "Publish.Nuget.ps1") + $nugetExecutable=[System.IO.Path]::Combine($scriptLocationDirectory, "nuget", "nuget.exe") + $projects = @('Musoq.Converter', 'Musoq.Evaluator', 'Musoq.Parser', 'Musoq.Plugins', 'Musoq.Schema') + + foreach ($project in $projects) { + pushd + cd "./$project/bin/Release" + Invoke-Expression "$scriptLocationFilePath $nugetExecutable $project '${{ secrets.nuget_musoq_key }}'" + popd + }