From 9e36604840649b5afed3a294980b1c835ce9ab30 Mon Sep 17 00:00:00 2001 From: ritasker Date: Thu, 8 Aug 2024 13:20:59 +0100 Subject: [PATCH] Add Publish Nuget Workflow --- .github/workflows/dotnet.yml | 6 ++---- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 61b63dc..8ef0c05 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,12 +1,10 @@ --- name: .Net Build on: - pull_request: null + pull_request: push: branches: - master - tags: - - "*" env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_CLI_TELEMETRY_OPTOUT: 1 @@ -25,4 +23,4 @@ jobs: - name: Update Submodules run: git submodule update --init --recursive - name: Build - run: dotnet build --configuration Release --nologo + run: dotnet build --configuration Release --nologo \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..53dcae9 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +--- +name: Publish Nuget +on: + push: + tags: + - "*" +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 +jobs: + publish: + name: Publish Nuget + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.* + - name: Publish Reason + run: echo ${{github.ref}} and ${{github.event_name}} + - name: Update Submodules + run: git submodule update --init --recursive + - name: Get version from tag + run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Pack project + run: dotnet pack ./src/Carter.SirenNegotiator.csproj -c Release -p:PackageVersion=$VERSION + - name: publish package + run: dotnet nuget push ./src/bin/Release/Carter.SirenNegotiator.$VERSION.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}