Skip to content

Release 2.0.0 changes. (#10) #12

Release 2.0.0 changes. (#10)

Release 2.0.0 changes. (#10) #12

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: SDK Workflow
on:
push:
branches:
- main
- 'release/**'
paths-ignore:
- README.md
- '**/README.md'
- .gitignore
- '**/.gitignore'
- 'CODEOWNERS'
pull_request:
branches:
- main
- 'release/**'
# The default trigger for Pull Requests are:
# - opened
# - synchronize
# - reopened
# Ref: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- README.md
- '**/README.md'
- .gitignore
- '**/.gitignore'
- 'CODEOWNERS'
workflow_dispatch:
inputs:
publish-release:
description: 'Publish Release'
required: false
default: 'No Publishing'
type: choice
options:
- No Publishing
- Beta-Internal
- Beta
- Prod-Internal
- Prod
publish-docs:
description: 'Publish Documentation to Github Pages'
required: false
default: false
type: boolean
jobs:
define-version:
runs-on: ubuntu-latest
outputs:
beta-version: ${{ steps.set-beta-version.outputs.betaversion }}
code-version: ${{ steps.get-version.outputs.codeversion }}
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- name: Set Beta Version
id: set-beta-version
if: ${{ inputs.publish-release != 'Prod' && inputs.publish-release != 'Prod-Internal' }}
run: |
# Gets the current version from Directory.Build.props. Example: 0.2.0
majorminorbuild=$(grep -oP '<Version>\K[^<]*' Directory.Build.props)
# Generate the beta sdk version using the format: currentversion-beta{workflow run number}.post{workflow run attempt}
# Examples: 0.2.0-beta1141.post1
sdkversion="$majorminorbuild-beta${{ github.run_number }}.post${{ github.run_attempt }}"
echo "betaversion=$sdkversion" >> "$GITHUB_OUTPUT"
- name: Get Version
id: get-version
if: ${{ inputs.publish-release == 'Prod' || inputs.publish-release == 'Prod-Internal' }}
run: |
# Gets the current version from Directory.Build.props. Example: 0.2.0
majorminorbuild=$(grep -oP '<Version>\K[^<]*' Directory.Build.props)
echo "codeversion=$majorminorbuild" >> "$GITHUB_OUTPUT"
dotnet-build:
needs: [ define-version ]
uses: ./.github/workflows/dotnet-build.yml
with:
beta-version: ${{ needs.define-version.outputs.beta-version }}
dotnet-test:
needs: [ define-version ]
uses: ./.github/workflows/dotnet-test.yml
python-test:
needs: [ dotnet-build ]
uses: ./.github/workflows/python-test.yml
dotnet-publish-package-internal-dryrun:
needs: [ define-version, dotnet-build ]
uses: ./.github/workflows/dotnet-package.yml
secrets: inherit
with:
published-os: ${{ vars.PUBLISH_OS }}
runs-on-config: ${{ vars.PUBLISH_PACKAGE_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: internal-dryrun
package-version: ${{ needs.define-version.outputs.beta-version }}
dotnet-publish-package-public-dryrun:
needs: [ define-version, dotnet-build ]
uses: ./.github/workflows/dotnet-package.yml
secrets: inherit
with:
published-os: ${{ vars.PUBLISH_OS }}
runs-on-config: ${{ vars.PUBLISH_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: public-dryrun
package-version: ${{ needs.define-version.outputs.beta-version }}
python-publish-package-internal-dryrun:
needs: [ define-version, dotnet-build ]
uses: ./.github/workflows/python-package.yml
secrets: inherit
with:
runs-on-config: ${{ vars.PUBLISH_PACKAGE_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: internal-dryrun
beta-version: ${{ needs.define-version.outputs.beta-version }}
publish-artifact: true
python-publish-package-public-dryrun:
needs: [ define-version, dotnet-build ]
uses: ./.github/workflows/python-package.yml
secrets: inherit
with:
runs-on-config: ${{ vars.PUBLISH_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: public-dryrun
beta-version: ${{ needs.define-version.outputs.beta-version }}
publish-docs-dry-run:
needs: [ dotnet-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/publishdocs-dryrun.yml
if: ${{ (inputs.publish-release != 'Prod' && inputs.publish-release != 'Prod-Internal' && inputs.publish-docs == false) || (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release/') && !startsWith(github.ref, 'refs/tags/release/')) }}
with:
runs-on-config: ${{ vars.DOCS_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
python-version: ${{ vars.PYTHON_PUBLISH_DOCS_VERSION }}
publish-docs:
needs: [ dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/publishdocs.yml
if: ${{ (inputs.publish-release == 'Prod' || inputs.publish-release == 'Prod-Internal' || inputs.publish-docs == true) && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/release/')) }}
with:
runs-on-config: ${{ vars.DOCS_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
python-version: ${{ vars.PYTHON_PUBLISH_DOCS_VERSION }}
create-release-from-dry-run:
needs: [ define-version, publish-docs-dry-run, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/create-release.yml
if: ${{ inputs.publish-release == 'Prod' || inputs.publish-release == 'Prod-Internal' || inputs.publish-release == 'Beta' }}
with:
runs-on-config: ${{ vars.PUBLISH_OS }}
release-version: ${{ needs.define-version.outputs.beta-version != '' && needs.define-version.outputs.beta-version || needs.define-version.outputs.code-version }}
is-pre-release: ${{ inputs.publish-release != 'Prod' && inputs.publish-release != 'Prod-Internal' }}
create-release:
needs: [ define-version, publish-docs, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/create-release.yml
if: ${{ inputs.publish-release == 'Prod' || inputs.publish-release == 'Prod-Internal' || inputs.publish-release == 'Beta' || inputs.publish-release == 'Beta-Internal' }}
with:
runs-on-config: ${{ vars.PUBLISH_OS }}
release-version: ${{ needs.define-version.outputs.beta-version != '' && needs.define-version.outputs.beta-version || needs.define-version.outputs.code-version }}
is-pre-release: ${{ inputs.publish-release != 'Prod' && inputs.publish-release != 'Prod-Internal' }}
dotnet-publish-package-internal-beta:
needs: [ dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/dotnet-package.yml
secrets: inherit
if: ${{ inputs.publish-release == 'Beta' || inputs.publish-release == 'Beta-Internal' }}
with:
published-os: ${{ vars.PUBLISH_OS }}
runs-on-config: ${{ vars.PUBLISH_PACKAGE_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: internal-beta
dotnet-publish-package-public-beta:
needs: [ dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/dotnet-package.yml
secrets: inherit
if: ${{ inputs.publish-release == 'Beta' }}
with:
published-os: ${{ vars.PUBLISH_OS }}
runs-on-config: ${{ vars.PUBLISH_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: public-beta
dotnet-publish-package-internal-prod:
needs: [ dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/dotnet-package.yml
secrets: inherit
if: ${{ (inputs.publish-release == 'Prod' || inputs.publish-release == 'Prod-Internal') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/release/')) }}
with:
published-os: ${{ vars.PUBLISH_OS }}
runs-on-config: ${{ vars.PUBLISH_PACKAGE_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: internal-prod
dotnet-publish-package-public-prod:
needs: [ dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/dotnet-package.yml
secrets: inherit
if: ${{ inputs.publish-release == 'Prod' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/release/')) }}
with:
published-os: ${{ vars.PUBLISH_OS }}
runs-on-config: ${{ vars.PUBLISH_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: public-prod
python-publish-package-internal-beta:
needs: [ define-version, dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/python-package.yml
secrets: inherit
if: ${{ inputs.publish-release == 'Beta' || inputs.publish-release == 'Beta-Internal' }}
with:
runs-on-config: ${{ vars.PUBLISH_PACKAGE_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: internal-beta
beta-version: ${{ needs.define-version.outputs.beta-version }}
python-publish-package-public-beta:
needs: [ define-version, dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/python-package.yml
secrets: inherit
if: ${{ inputs.publish-release == 'Beta' }}
with:
runs-on-config: ${{ vars.PUBLISH_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: public-beta
beta-version: ${{ needs.define-version.outputs.beta-version }}
python-publish-package-internal-prod:
needs: [ define-version, dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/python-package.yml
secrets: inherit
if: ${{ (inputs.publish-release == 'Prod' || inputs.publish-release == 'Prod-Internal') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/release/')) }}
with:
runs-on-config: ${{ vars.PUBLISH_PACKAGE_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: internal-prod
beta-version: ${{ needs.define-version.outputs.beta-version }}
python-publish-package-public-prod:
needs: [ define-version, dotnet-test, python-test, dotnet-publish-package-internal-dryrun, dotnet-publish-package-public-dryrun, python-publish-package-internal-dryrun, python-publish-package-public-dryrun ]
uses: ./.github/workflows/python-package.yml
secrets: inherit
if: ${{ inputs.publish-release == 'Prod' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/release/')) }}
with:
runs-on-config: ${{ vars.PUBLISH_OS }}
build-config: ${{ vars.PUBLISH_CONFIGURATION }}
publish-environment: public-prod
beta-version: ${{ needs.define-version.outputs.beta-version }}