From 66942979ab2e77f620c3cde712e0192eeb59cdc0 Mon Sep 17 00:00:00 2001 From: Afshin Arani Date: Thu, 2 Apr 2020 18:47:25 +0800 Subject: [PATCH] Add GithubActions workflow for nugetUpload --- .github/workflows/nugetUpload.yml | 29 ++++++++++++++++++++++++++++ src/TgSharp.Core/TgSharp.Core.nuspec | 8 ++++---- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/nugetUpload.yml diff --git a/.github/workflows/nugetUpload.yml b/.github/workflows/nugetUpload.yml new file mode 100644 index 0000000..5b69603 --- /dev/null +++ b/.github/workflows/nugetUpload.yml @@ -0,0 +1,29 @@ +name: nugetUpload +on: [push, pull_request] + +env: + NUGET_URL: https://dist.nuget.org/win-x86-commandline/v5.4.0/nuget.exe +jobs: + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + + - name: Download Nuget.exe + run: Invoke-WebRequest -OutFile Nuget.exe $Env:NUGET_URL + + - name: Install Dependencies + run: ./Nuget.exe restore src/TgSharp.sln + + - name: setup-msbuild + uses: microsoft/setup-msbuild@v1 + + - name: Build & Upload Package + run: | + $date = get-date -format "yyyyMMdd-HHmm" + $hash = & git rev-parse --short HEAD + + ./Nuget.exe pack src/TgSharp.Core/TgSharp.Core.csproj -Version "0.0.1-date.$date.git.$hash" -Build -Properties Configuration=Release + If ($Env:GITHUB_REF -eq 'refs/heads/master' -AND '${{ secrets.NUGET_API_KEY }}' -ne '') { + ./Nuget.exe push "TgSharp.0.0.1-date.$date.git.$hash.nupkg" ${{secrets.NUGET_API_KEY}} -Source https://api.nuget.org/v3/index.json + } diff --git a/src/TgSharp.Core/TgSharp.Core.nuspec b/src/TgSharp.Core/TgSharp.Core.nuspec index ac519b3..06ce878 100644 --- a/src/TgSharp.Core/TgSharp.Core.nuspec +++ b/src/TgSharp.Core/TgSharp.Core.nuspec @@ -15,9 +15,9 @@ It's a perfect fit for any developer who would like to send data directly to Tel Copyright 2015-2020 - - - - + + + +