From eb98c44b8a93c4bfcbc26ec46b8e6a356e778321 Mon Sep 17 00:00:00 2001 From: Andrea Cattaneo Date: Fri, 10 Feb 2023 14:53:34 +0100 Subject: [PATCH] fix github action --- .github/workflows/build.yml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b683e92..c079d46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: build and publish on: push: - branches: [ "master" ] + branches: ["master"] pull_request: - branches: [ "master" ] + branches: ["master"] jobs: build: @@ -14,13 +14,7 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v1.1 - - - name: Setup NuGet - uses: nuget/setup-nuget@v1 - with: - nuget-api-key: ${{ secrets.NuGetAPIKey }} - nuget-version: '5.x' - + - run: cd $GITHUB_WORKSPACE #- uses: actions/setup-python@v4 @@ -30,7 +24,7 @@ jobs: #- name: Change package version # run: | # python -c "import urllib.request; urllib.request.urlretrieve('https://raw.githubusercontent.com/il-katta/jenkins-libs/master/resources/it/loopback/jenkins/projedit.py', 'projedit.py')" - # foreach ($file in (Get-ChildItem ./ACUtils*/*.csproj) ) { + # foreach ($file in (Get-ChildItem ./ACUtils*/*.csproj) ) { # $version = python projedit.py netstandard $file # Write-Output "::set-output name=PROJECT_VERSION::$version" # } @@ -38,7 +32,7 @@ jobs: - name: Restore packages run: nuget restore ACUtils.sln - + - name: Build run: | msbuild.exe ACUtils.sln /p:Configuration="Release" /p:Platform="Any CPU" /t:"Restore" @@ -59,7 +53,7 @@ jobs: path: | dist/*.nupkg dist/*.snupkg - + #- name: Create release # uses: "marvinpinto/action-automatic-releases@latest" # with: @@ -69,13 +63,25 @@ jobs: # files: | # dist/*.nupkg # dist/*.snupkg + publish: + needs: build runs-on: windows-2019 if: github.ref == 'refs/heads/master' steps: + - name: Setup NuGet + uses: nuget/setup-nuget@v1 + with: + nuget-api-key: ${{ secrets.NuGetAPIKey }} + nuget-version: "5.x" + + - uses: actions/download-artifact@v3 + with: + name: nuget-packages + path: . + - name: Publish run: | - foreach ($file in (Get-ChildItem dist/*.nupkg) ) { + foreach ($file in (Get-ChildItem *.nupkg) ) { nuget push $file -Source https://api.nuget.org/v3/index.json -SkipDuplicate } -