From 9051ccaf28b992f2ade77799b9d2071198b24c25 Mon Sep 17 00:00:00 2001 From: Paul Welter Date: Sat, 29 Jul 2023 01:09:24 -0500 Subject: [PATCH] update versioning --- .editorconfig | 4 +-- .github/workflows/dotnet.yml | 51 +++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/.editorconfig b/.editorconfig index 8a4a439..c85887d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: https://EditorConfig.org +# EditorConfig: https://EditorConfig.org root = true @@ -11,7 +11,7 @@ insert_final_newline = true trim_trailing_whitespace = true # XML Configuration Files -[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}] +[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct,refactorlog,runsettings}] indent_size = 2 # JSON Files diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 91229dd..747f36d 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,9 +1,9 @@ name: Build Project env: - BUILD_PATH: '${{github.workspace}}/packages' - BUILD_VERSION: '2.5.${{github.run_number}}' - BUILD_INFORMATION: 2.5.${{github.run_number}}+Branch.${{github.ref_name}}.Sha.${{github.sha}}' + DOTNET_NOLOGO: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BUILD_PATH: '${{github.workspace}}/artifacts' on: push: @@ -25,22 +25,30 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Setup .NET + - name: Install .NET Core uses: actions/setup-dotnet@v3 with: dotnet-version: 7.0.x - - name: Restore dependencies + - name: Calculate Version + run: | + dotnet tool update -g minver-cli + echo "BUILD_VERSION=$(minver -v e -t v)" >> $GITHUB_ENV + + - name: Restore Dependencies run: dotnet restore - - name: Build Project - run: 'dotnet build --no-restore --configuration Release -p:Version="${{env.BUILD_VERSION}}" -p:InformationalVersion="${{env.BUILD_INFORMATION}}"' + - name: Build Solution + run: 'dotnet build --no-restore --configuration Release -p:Version="${{env.BUILD_VERSION}}" -p:InformationalVersion="${{env.BUILD_VERSION}}+${{github.sha}}"' - name: Run Test run: dotnet test --no-build --configuration Release --verbosity normal - name: Create Packages + if: success() && github.event_name != 'pull_request' run: 'nuget pack Injectio.nuspec -Version "${{env.BUILD_VERSION}}" -OutputDirectory "${{env.BUILD_PATH}}" -p Configuration=Release' - name: Upload Packages @@ -50,19 +58,36 @@ jobs: name: packages path: '${{env.BUILD_PATH}}' - - name: Publish Packages - if: success() && github.event_name != 'pull_request' + deploy: + runs-on: ubuntu-latest + needs: build + if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + + steps: + - name: Download Artifact + uses: actions/download-artifact@v3 + with: + name: packages + + - name: Publish Packages GitHub + run: | + for package in $(find -name "*.nupkg"); do + echo "${0##*/}": Pushing $package... + dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate + done + + - name: Publish Packages feedz run: | - dotnet nuget add source --username pwelter34 --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/loresoft/index.json" for package in $(find -name "*.nupkg"); do echo "${0##*/}": Pushing $package... - dotnet nuget push $package --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate + dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate done - - name: Publish Release Packages - if: success() && startsWith(github.ref, 'refs/tags/v') + - name: Publish Packages Nuget + if: startsWith(github.ref, 'refs/tags/v') run: | for package in $(find -name "*.nupkg"); do echo "${0##*/}": Pushing $package... dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate done +