refactor(git): extract shared backend logic into Core to deduplicate the adapters #5182
Workflow file for this run
This file contains hidden or 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: | |
| - main | |
| - 'fix/*' | |
| - 'feature/*' | |
| - 'poc/*' | |
| - 'support/*' | |
| - 'next/*' | |
| paths: | |
| - '**' | |
| - '!docs/**' | |
| pull_request: | |
| branches: | |
| - main | |
| - 'support/*' | |
| - 'next/*' | |
| # gate managed-git phase PRs with the full test matrix pre-merge (#5031) | |
| - 'feature/managed-git' | |
| paths: | |
| - '**' | |
| - '!docs/**' | |
| merge_group: | |
| types: [ checks_requested ] | |
| repository_dispatch: | |
| types: [ ci-release ] | |
| env: | |
| DOTNET_ROLL_FORWARD: "Major" | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: 1 | |
| TESTINGPLATFORM_TELEMETRY_OPTOUT: 1 | |
| ENABLED_DIAGNOSTICS: ${{ vars.ENABLED_DIAGNOSTICS }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| prepare: | |
| name: Prepare | |
| permissions: | |
| contents: read | |
| uses: ./.github/workflows/_prepare.yml | |
| publish_flags: | |
| name: Publish Flags | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| outputs: | |
| can_publish: ${{ steps.flags.outputs.can_publish }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 | |
| with: | |
| egress-policy: audit | |
| - name: Resolve publish flag | |
| id: flags | |
| shell: bash | |
| run: echo "can_publish=${{ github.repository == 'GitTools/GitVersion' && github.ref_name == 'main' }}" >> "$GITHUB_OUTPUT" | |
| build: | |
| name: Build & Package | |
| needs: [ prepare ] | |
| permissions: | |
| contents: read | |
| uses: ./.github/workflows/_build.yml | |
| unit_test: | |
| name: Test | |
| needs: [ prepare, publish_flags ] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| uses: ./.github/workflows/_unit_tests.yml | |
| with: | |
| dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }} | |
| publish_coverage: ${{ fromJson(needs.publish_flags.outputs.can_publish) }} | |
| secrets: inherit | |
| artifacts_windows_test: | |
| name: Artifacts Windows | |
| needs: [ build ] | |
| permissions: | |
| contents: read | |
| uses: ./.github/workflows/_artifacts_windows.yml | |
| artifacts_linux_test: | |
| needs: [ prepare, build ] | |
| name: Artifacts Linux (${{ matrix.arch }}) | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-24.04 | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| uses: ./.github/workflows/_artifacts_linux.yml | |
| with: | |
| runner: ${{ matrix.runner }} | |
| arch: ${{ matrix.arch }} | |
| docker_distros: ${{ needs.prepare.outputs.docker_distros }} | |
| dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }} | |
| docker_linux_images: | |
| needs: [ prepare, build, publish_flags ] | |
| name: Docker Images (${{ matrix.arch }}) | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-24.04 | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| uses: ./.github/workflows/_docker.yml | |
| with: | |
| runner: ${{ matrix.runner }} | |
| arch: ${{ matrix.arch }} | |
| docker_distros: ${{ needs.prepare.outputs.docker_distros }} | |
| dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }} | |
| publish_images: ${{ fromJson(needs.publish_flags.outputs.can_publish) }} | |
| secrets: inherit | |
| docker_linux_manifests: | |
| needs: [ prepare, docker_linux_images, publish_flags ] | |
| name: Docker Manifests | |
| permissions: | |
| contents: read | |
| packages: write | |
| uses: ./.github/workflows/_docker_manifests.yml | |
| with: | |
| docker_distros: ${{ needs.prepare.outputs.docker_distros }} | |
| dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }} | |
| publish_manifests: ${{ fromJson(needs.publish_flags.outputs.can_publish) }} | |
| secrets: inherit | |
| publish: | |
| name: Publish | |
| needs: [ artifacts_windows_test, artifacts_linux_test, publish_flags ] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| uses: ./.github/workflows/_publish.yml | |
| with: | |
| publish_packages: ${{ fromJson(needs.publish_flags.outputs.can_publish) }} | |
| secrets: inherit | |
| release: | |
| name: Release | |
| needs: [ publish, docker_linux_manifests ] | |
| runs-on: windows-2025-vs2026 | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| issues: write | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| CAN_PUBLISH: ${{ github.event_name == 'repository_dispatch' }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Restore State | |
| uses: ./.github/actions/cache-restore | |
| - name: Restore Artifacts | |
| uses: ./.github/actions/artifacts-restore | |
| - name: Attestation | |
| if: env.CAN_PUBLISH == 'true' | |
| uses: ./.github/actions/artifacts-attest | |
| - name: Load DockerHub credentials | |
| id: dockerhub-creds | |
| if: env.CAN_PUBLISH == 'true' | |
| uses: gittools/cicd/dockerhub-creds@824c3d773fb5d1b00c26b474ae88b7ce9ae555ee # v5 | |
| with: | |
| op_service_account_token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | |
| - name: DockerHub Publish Readme | |
| if: env.CAN_PUBLISH == 'true' | |
| shell: pwsh | |
| run: dotnet run/docker.dll --target=DockerHubReadmePublish | |
| env: | |
| DOCKER_USERNAME: ${{ steps.dockerhub-creds.outputs.docker_username }} | |
| DOCKER_PASSWORD: ${{ steps.dockerhub-creds.outputs.docker_password }} | |
| - name: '[Release]' | |
| shell: pwsh | |
| run: dotnet run/release.dll --target=PublishRelease | |
| - name: '[Publish Release]' | |
| if: github.event_name == 'repository_dispatch' | |
| uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1 | |
| with: | |
| token: ${{ github.token }} | |
| repository: ${{ github.repository }} | |
| event-type: publish-release | |
| client-payload: | | |
| { | |
| "ref": "${{ github.ref }}", | |
| "sha": "${{ github.sha }}", | |
| "tag": "${{ github.event.client_payload.tag }}" | |
| } |