From f6a9fff9e0672793704c0e1608495fa801c33560 Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Sat, 3 Dec 2022 18:06:41 -0500 Subject: [PATCH 1/6] created basic nuget publish All build / publish actions are turned off for now, im just testing --- .github/workflows/main.yml | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4aa0760 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,53 @@ +name: PublishToNugetWithSymbols + +on: + create: + branches: + - release/** + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + + env: + BUILD_CONFIG: 'Release' + SOLUTION: 'MySolution.sln' + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Get Build Version + run: | + Import-Module .\build\GetBuildVersion.psm1 + Write-Host $Env:GITHUB_REF + $version = GetBuildVersion -VersionString $Env:GITHUB_REF + echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append + shell: pwsh + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.1.1 + + - name: Restore dependencies + run: nuget restore $SOLUTION + + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.100 + + # - name: Build + # run: dotnet build $SOLUTION --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore + + # - name: Run tests + # run: dotnet test /p:Configuration=$env:BUILD_CONFIG --no-restore --no-build --verbosity normal + +# - name: Publish +# if: startsWith(github.ref, 'refs/heads/release') +# run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_PUBLISH_KEY}} From 6422af0506233b8afa6b7a5131aafa2497edc323 Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Sat, 3 Dec 2022 18:16:43 -0500 Subject: [PATCH 2/6] fixed versions and build versions --- .github/workflows/main.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4aa0760..6f9dee4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,20 +16,16 @@ jobs: env: BUILD_CONFIG: 'Release' - SOLUTION: 'MySolution.sln' + SOLUTION: 'Testura.Code.sln' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2.5.0 - - name: Get Build Version - run: | - Import-Module .\build\GetBuildVersion.psm1 - Write-Host $Env:GITHUB_REF - $version = GetBuildVersion -VersionString $Env:GITHUB_REF - echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - shell: pwsh + - name: Increment Build Version (minor version) + run: | + sed -i "s/\(\([0-9]\+\.\)\{2\}\)\([0-9]\+\)/\1${{github.run_number}}/" Testura.Code.csproj - name: Setup NuGet uses: NuGet/setup-nuget@v1.1.1 From 95c3369e7ebab503fa9fae02a3bf438aeca730eb Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Sat, 3 Dec 2022 18:22:25 -0500 Subject: [PATCH 3/6] fixed working --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f9dee4..fbbef0b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: steps: - uses: actions/checkout@v2.5.0 - - name: Increment Build Version (minor version) + - name: Increment Build Version (patch number only) run: | sed -i "s/\(\([0-9]\+\.\)\{2\}\)\([0-9]\+\)/\1${{github.run_number}}/" Testura.Code.csproj From 02264c92f443e648e615aafa05ae007da8fae34a Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Sat, 3 Dec 2022 18:33:37 -0500 Subject: [PATCH 4/6] Added symbol support Changes: - Removed nuget cli - Added symbol support Notes: https://github.com/NuGet/docs.microsoft.com-nuget/blob/main/docs/create-packages/Symbol-Packages-snupkg.md --- .github/workflows/main.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fbbef0b..510b54a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,9 +27,6 @@ jobs: run: | sed -i "s/\(\([0-9]\+\.\)\{2\}\)\([0-9]\+\)/\1${{github.run_number}}/" Testura.Code.csproj - - name: Setup NuGet - uses: NuGet/setup-nuget@v1.1.1 - - name: Restore dependencies run: nuget restore $SOLUTION @@ -43,7 +40,13 @@ jobs: # - name: Run tests # run: dotnet test /p:Configuration=$env:BUILD_CONFIG --no-restore --no-build --verbosity normal + +# - name: Pack +# run: dotnet pack /src/Testura.Code.csproj -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + -# - name: Publish +# - name: Publish Package and Symbols # if: startsWith(github.ref, 'refs/heads/release') -# run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_PUBLISH_KEY}} +# run: | +# nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_PUBLISH_KEY}} +# nuget push **\*.snupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_PUBLISH_KEY}} From 49d5bb072838a0509e28c11ff627a20996162ea1 Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Sat, 3 Dec 2022 18:34:01 -0500 Subject: [PATCH 5/6] Fixed spaces --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 510b54a..bdaab5c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,8 +42,7 @@ jobs: # run: dotnet test /p:Configuration=$env:BUILD_CONFIG --no-restore --no-build --verbosity normal # - name: Pack -# run: dotnet pack /src/Testura.Code.csproj -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg - +# run: dotnet pack /src/Testura.Code.csproj -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg # - name: Publish Package and Symbols # if: startsWith(github.ref, 'refs/heads/release') From 73f5b7c37d45af9485cb5d265ec8c878785b0255 Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Sat, 3 Dec 2022 18:36:43 -0500 Subject: [PATCH 6/6] Added path to increment build version Increment Build version notes: https://stackoverflow.com/a/71000473/5022269 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bdaab5c..ca83aed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: - name: Increment Build Version (patch number only) run: | - sed -i "s/\(\([0-9]\+\.\)\{2\}\)\([0-9]\+\)/\1${{github.run_number}}/" Testura.Code.csproj + sed -i "s/\(\([0-9]\+\.\)\{2\}\)\([0-9]\+\)/\1${{github.run_number}}/" /src/Testura.Code.csproj - name: Restore dependencies run: nuget restore $SOLUTION