From 081189da67cf3ad1028add6af38d25f1ce4618ab Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 19 Feb 2022 20:45:10 -0800 Subject: [PATCH] Tag and publish release --- .github/workflows/BuildPublishPipeline.yml | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/BuildPublishPipeline.yml b/.github/workflows/BuildPublishPipeline.yml index 698923d..027985e 100644 --- a/.github/workflows/BuildPublishPipeline.yml +++ b/.github/workflows/BuildPublishPipeline.yml @@ -47,7 +47,7 @@ jobs: - name: 'Build Project' run: >- dotnet build ./Utilities/Utilities.csproj - --output ./Utilities/Artifacts + --output ./Publish/ --configuration ${{ endsWith(github.ref, 'refs/heads/main') && 'Release' || 'Debug' }} -property:Version=${{ steps.nbgv.outputs.AssemblyVersion }} -property:FileVersion=${{ steps.nbgv.outputs.AssemblyFileVersion }} @@ -62,7 +62,7 @@ jobs: if: ${{ github.event_name != 'pull_request' }} # Use build platform specific path convention, relative paths do not work run: >- - dotnet nuget push ${{ github.workspace }}/Utilities/Artifacts/*.nupkg + dotnet nuget push ${{ github.workspace }}/Publish/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY}} --skip-duplicate @@ -74,7 +74,26 @@ jobs: if: ${{ github.event_name != 'pull_request' }} # Use build platform specific path convention, relative paths do not work run: >- - dotnet nuget push ${{ github.workspace }}/Utilities/Artifacts/*.nupkg + dotnet nuget push ${{ github.workspace }}/Publish/*.nupkg --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate + + # Zip the output + - name: 'Zip Output' + run: 7z a -t7z ./Publish/Utilities.7z ./Publish/* + + # Create GitHub release + # https://github.com/marketplace/actions/automatic-releases + - name: 'Create GitHub Release' + # Do not push on pull requests + if: ${{ (github.event_name != 'pull_request') }} + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: ${{ steps.nbgv.outputs.SemVer2 }} + # Only main branch is not a pre-release + prerelease: ${{ !endsWith(github.ref, 'refs/heads/main') }} + files: | + LICENSE + ./Publish/Utilities.7z