diff --git a/.github/workflows/publish.yml b/.github/workflows/publish_release.yml similarity index 63% rename from .github/workflows/publish.yml rename to .github/workflows/publish_release.yml index d48a9e0..8f263a5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish_release.yml @@ -1,10 +1,7 @@ name: Publish on: - push: - branches: - - master - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + release: + types: [published] env: Configuration: Release ProjectDir: src\SourceGenerator.Foundations\ @@ -15,7 +12,6 @@ jobs: name: build, bundle & publish runs-on: windows-latest steps: - # CheckOut - uses: actions/checkout@v3 with: ref: ${{ github.head_ref }} # checkout the correct branch name @@ -24,9 +20,15 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.x - - run: dotnet tool restore - - run: dotnet gitversion /output buildserver - - run: dotnet build ${{env.SolutionPath}} -t:build -p:Version=${{env.GitVersion_AssemblySemVer}} --configuration ${{env.Configuration}} - - run: dotnet test ${{env.SolutionPath}} - - run: dotnet build ${{env.SolutionPath}} -t:pack -p:PackageVersion=${{env.GitVersion_SemVer}} --configuration ${{env.Configuration}} - - run: dotnet nuget push ${{env.ProjectDir}}bin\${{env.Configuration}}\*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json + - name: Restore + run: dotnet tool restore + - name: GitVersion + run: dotnet gitversion /output buildserver + - name: Build + run: dotnet build ${{env.SolutionPath}} -t:build -p:Version=${{env.GitVersion_AssemblySemVer}} --configuration ${{env.Configuration}} + - name: Test + run: dotnet test ${{env.SolutionPath}} + - name: Build + run: dotnet build ${{env.SolutionPath}} -t:pack -p:PackageVersion=${{env.GitVersion_SemVer}} --configuration ${{env.Configuration}} + - name: Push NuGet + run: dotnet nuget push ${{env.ProjectDir}}bin\${{env.Configuration}}\*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json