Update nuget packages #211
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- "release*" | |
pull_request: | |
jobs: | |
build: | |
name: .NET | |
runs-on: ubuntu-latest | |
env: | |
solutionPath: ./Source/Sundew.CommandLine.sln | |
versioningProjectPath: ./Source/Sundew.CommandLine/Sundew.CommandLine.csproj | |
repository: 'https://sundew-dev:${{ secrets.SUNDEW_DEV_TOKEN }}@github.com/sundews/Sundew.CommandLine.git' | |
source: 'https://api.nuget.org/v3/index.json' | |
dev-source: 'https://www.myget.org/F/sundew-dev/api/v2/package' | |
dev-source-latest-version: 'https://www.myget.org/F/sundew-dev/api/v3/index.json' | |
dev-symbols-source: 'https://www.myget.org/F/sundew-dev/api/v3/index.json' | |
packages-to-push: 'logs/packages.push' | |
source-packages-to-push: './Source/logs/packages.push' | |
steps: | |
- name: 'Await other builds' | |
uses: softprops/turnstyle@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup .NET 7 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.x.x | |
- name: Build setup | |
id: build-setup | |
run: > | |
dotnet tool update Sundew.Packaging.Tool -g --version 7.8.* | |
dotnet tool update CommandlineBatcher -g --version 7.6.* | |
git rev-parse --short=10 HEAD | cb -c ">> $GITHUB_OUTPUT|git-hash={0}{NL}" --batches-stdin | |
cb match -p "(?<Input>^(?!(refs/pull.*|refs/heads/$)).+) => git-branch-name={Input}" -i "refs/heads/${{ github.base_ref }}" "${{ github.ref }}" -of $Env:GITHUB_OUTPUT | |
- name: Stage Build | |
id: stage-build | |
run: > | |
spt stage-build --project-file "${{ env.versioningProjectPath }}" | |
--production "refs/(heads/release/.+|tags/release) => ${{ secrets.SPP_API_KEY }}@${{ env.source }}|${{ env.source }}||Configuration=Release" | |
--integration "refs/heads/(?:master|main).* => &u{DateTime}-{Stage} ${{ secrets.SPP_API_KEY }}@${{ env.source }}|${{ env.source }}||Configuration=Debug|DevFeedSource= -s ${{ env.dev-source-latest-version }}" | |
--development "refs/heads/(?:develop.*|feature/(?<Postfix>.+)|bugfix/(?<Postfix>.+)) => ${{ secrets.SPP_DEVELOPMENT_API_KEY }}@${{ env.dev-source }} {${{ env.dev-source-latest-version }}}|${{ secrets.SPP_DEVELOPMENT_API_KEY }}@${{ env.dev-symbols-source }}||Configuration=Debug|DevFeedSource= -s ${{ env.dev-source-latest-version }}" | |
--no-stage "Configuration=Release" | |
--stage "${{ github.ref }}" | |
--prerelease-format "u{DateTime}-{Stage}-{Postfix}" | |
--metadata ${{ steps.build-setup.outputs.git-hash }} | |
--force-version '"${{ secrets.SPP_FORCE_VERSION_IF_SET }}"' | |
--output-formats "Selected stage: {Stage}, {FullVersion}, {Configuration}" ">|stage={Stage}{NL}" ">|version={Version}{NL}" ">|buildConfiguration={Configuration}{NL}" | |
">|nuGetPackagesPath={WorkingDirectory}/NuGet{NL}" ">|dev-package-source-if-set={DevFeedSource}{NL}" ">|feedSource={FeedSource}{NL}" | |
">|pushSource={PushSource}{NL}" ">|apiKey={ApiKey}{NL}" ">|fullVersion={FullVersion}{NL}" ">|symbolsPushSource={SymbolsPushSource}{NL}" | |
">|symbolsApiKey={SymbolsApiKey}{NL}" | |
--output-file $GITHUB_OUTPUT | |
cb match -p "^refs/tags/release[^/]*$ => isReleaseCommand=true" -i "${{ github.ref }}" -of $GITHUB_OUTPUT | |
- name: Restore | |
run: dotnet restore ${{ env.solutionPath }} --verbosity normal -s ${{ env.source }}${{ steps.stage-build.outputs.dev-package-source-if-set }} | |
- name: Build | |
id: build | |
run: > | |
dotnet build ${{ env.solutionPath }} --verbosity normal --configuration ${{ steps.stage-build.outputs.buildConfiguration }} --no-restore | |
-p:"ContinuousIntegrationBuild=true" | |
-p:"SppForceVersion=${{ steps.stage-build.outputs.fullVersion }}" | |
'-p:"SppAppendPublishFileLogFormats={PackageId}={DQ}{PackagePath}{DQ}={Version}{NL} > ${{ env.packages-to-push }}"' | |
-p:GeneratePackageOnBuild=true | |
-p:"PackageOutputPath=${{ steps.stage-build.outputs.nuGetPackagesPath }}" | |
- name: Test | |
run: dotnet test ${{ env.solutionPath }} --verbosity normal --configuration ${{ steps.stage-build.outputs.buildConfiguration }} --no-build | |
- name: 'Publish package(s)' | |
if: ${{ steps.stage-build.outputs.stage != 'none' }} | |
run: cb -c "spt|push -s ${{ steps.stage-build.outputs.pushSource }} -k ${{ steps.stage-build.outputs.apiKey }} -ss ${{ steps.stage-build.outputs.symbolsPushSource }} -sk ${{ steps.stage-build.outputs.symbolsApiKey }} {1}" -bs NewLine -bvs '=' -bf ${{ env.source-packages-to-push }} | |
- name: 'Tag stable version' | |
if: ${{ steps.stage-build.outputs.stage == 'production' }} | |
run: | | |
git config user.email "sundew-dev@outlook.com" | |
git config user.name "sundew-build" | |
git tag -a v.${{ steps.stage-build.outputs.version }} -m "v.${{ steps.stage-build.outputs.version }}" | |
git push ${{ env.repository }} v.${{ steps.stage-build.outputs.version }} | |
cb --if "${{ steps.stage-build.outputs.isReleaseCommand }} == true" -c "git|push --delete ${{ env.repository }} ${{ github.ref }}" | |
- name: 'Await stable package publish' | |
if: ${{ steps.stage-build.outputs.stage == 'production' }} | |
run: cb -c "spt|await -s ${{ steps.stage-build.outputs.feedSource }} {0}.{2}" -bs NewLine -bvs '=' -bf ${{ env.source-packages-to-push }} |