Populate factorymethods code fix now generates methods for nested cases #357
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: | |
concurrency: | |
group: ${{ github.ref == 'refs/tags/release' && github.ref || github.run_id }} | |
jobs: | |
build: | |
name: .NET | |
runs-on: ubuntu-latest | |
env: | |
solutionPath: ./Source/Sundew.DiscriminatedUnions.sln | |
versioningProjectPath: ./Source/Sundew.DiscriminatedUnions.Package/Sundew.DiscriminatedUnions.Package.csproj | |
repository: 'https://sundew-dev:${{ secrets.SUNDEW_DEV_TOKEN }}@github.com/sundews/Sundew.DiscriminatedUnions.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: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.x.x | |
- name: Build setup | |
id: build-setup | |
run: > | |
dotnet tool update Sundew.Packaging.Tool -g --version 8.10.* | |
dotnet tool update CommandlineBatcher -g --version 8.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 $GITHUB_OUTPUT | |
git log -1 --pretty=%B > git_commit_message.txt | |
- 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 }}" | |
--build-promotion-input "< git_commit_message.txt" | |
--build-promotion-regex "=>\s*release" | |
--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}" ">|buildPromotion={BuildPromotion}" | |
--output-file $GITHUB_OUTPUT | |
cb match -p "^(?!^(refs/heads/main|refs/tags/release)$).*$ => test-filter-if-set= --filter Category!~MainBranchBuilds" -i "${{ steps.build-setup.outputs.git-branch-name }}" -of $GITHUB_OUTPUT | |
- name: 'Remove release tag' | |
if: ${{ steps.stage-build.outputs.stage == 'production' && steps.stage-build.outputs.buildPromotion != 'promoted' }} | |
run: git push --delete ${{ env.repository }} ${{ github.ref }} | |
- 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${{ steps.stage-build.outputs.test-filter-if-set }} | |
- 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} -r 4" -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 "${{ secrets.BUILD_EMAIL }}" | |
git config user.name "${{ secrets.BUILD_USERNAME }}" | |
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 }} | |
- 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 }} | |
- name: 'Summary' | |
run: | | |
echo '### Pushed version: ${{ steps.stage-build.outputs.fullVersion }}' >> $GITHUB_STEP_SUMMARY |