[v2] Update CI to .NET 9 RC 1 #658
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: | |
workflow_dispatch: | |
release: | |
types: [published,prereleased] | |
push: | |
tags: 'v**' | |
branches: | |
- main | |
- develop | |
- 'release-**' | |
paths: | |
- '.github/**' | |
- 'Source/**' | |
- 'src/**' | |
- 'docs/**' | |
pull_request: | |
branches: | |
- main | |
- develop | |
- 'release-**' | |
paths: | |
- '.github/**' | |
- 'Source/**' | |
- 'src/**' | |
- 'docs/**' | |
jobs: | |
init: | |
runs-on: windows-latest | |
steps: | |
- name: Initialize environment variables | |
id: find-environment | |
shell: bash | |
run: | | |
if [[ "${{ github.event_name }}" != "pull_request" ]]; then | |
branch_name=${{ github.ref_name }} | |
else | |
branch_name=${{ github.base_ref }} | |
fi | |
target_br_name=${branch_name//\//-} | |
echo "Running on branch: ${branch_name}" | |
echo "Target branch is: ${target_br_name}" | |
if [[ "${branch_name}" == *"main"* || "${{ github.ref }}" == "refs/tags/v"* ]]; then | |
environment=Production | |
elif [[ "${branch_name}" == *"develop"* ]]; then | |
environment=Development | |
elif [[ "${branch_name}" == *"release"* ]]; then | |
environment=Release-Previews | |
else | |
environment=Development | |
fi | |
if [[ "${environment}" == "Production" || "${environment}" == "Release-Previews" ]]; then | |
echo "deploy_nuget_pckge=true" >> "$GITHUB_ENV" | |
echo "NuGet package deployment is enabled" | |
else | |
echo "deploy_nuget_pckge=false" >> "$GITHUB_ENV" | |
echo "NuGet package deployment is disabled" | |
fi | |
echo "Found environment: ${environment}" | |
echo "env_name=${environment}" >> "$GITHUB_ENV" | |
echo "target_br_name=${target_br_name}" >> "$GITHUB_ENV" | |
outputs: | |
environment_name: ${{ env.env_name }} | |
target_branch_name: ${{ env.target_br_name }} | |
deploy_nuget_package: ${{ env.deploy_nuget_pckge }} | |
stable: | |
needs: [init] | |
uses: ./.github/workflows/build.yml | |
secrets: inherit | |
with: | |
should_run: true | |
environment_name: ${{ needs.init.outputs.environment_name }} | |
target_branch_name: ${{ needs.init.outputs.target_branch_name }} | |
working_directory: 'Source' | |
project_names: 'Source/Lib/Trakt.NET/Trakt.NET.csproj' | |
build_configuration: Release | |
binaries_root_directories: 'Source/Lib/Trakt.NET/bin' | |
artifacts_root_directory: 'artifacts' | |
artifacts_archive_name: 'Trakt.NET-CI-Build-${{ needs.init.outputs.target_branch_name }}' | |
upload_codecov: true | |
push_nuget_package: ${{ needs.init.outputs.deploy_nuget_package == 'true' }} | |
v2-alpha: | |
needs: [init] | |
uses: ./.github/workflows/build.yml | |
secrets: inherit | |
with: | |
should_run: ${{ github.ref_name == 'develop' }} | |
environment_name: ${{ needs.init.outputs.environment_name }} | |
target_branch_name: ${{ needs.init.outputs.target_branch_name }} | |
working_directory: 'src' | |
project_names: 'src/libs/Trakt.NET/Trakt.NET.csproj;src/libs/Trakt.NET.HttpClientFactory/Trakt.NET.HttpClientFactory.csproj' | |
build_configuration: Release | |
binaries_root_directories: 'src/libs/Trakt.NET/bin;src/libs/Trakt.NET.HttpClientFactory/bin' | |
artifacts_root_directory: 'artifacts-v2.0.0-alpha' | |
artifacts_sub_directories: 'netstandard2.0,netstandard2.1,net6.0,net7.0,net8.0' | |
artifacts_archive_name: 'Trakt.NET-CI-Build-v2.0.0-Alpha-${{ needs.init.outputs.target_branch_name }}' | |
upload_codecov: false | |
push_nuget_package: false | |
docs: | |
needs: [init, stable] | |
uses: ./.github/workflows/documentation.yml | |
secrets: inherit | |
with: | |
should_run: ${{ !contains(github.ref, 'pull') && !contains(github.ref, 'epic') && github.actor != 'dependabot[bot]' }} | |
environment_name: ${{ needs.init.outputs.environment_name }} | |
project_name: 'Source/Lib/Trakt.NET/Trakt.NET.csproj' | |
build_configuration: Release | |
artifacts_archive_name: 'Trakt.NET-Documentation-${{ needs.init.outputs.target_branch_name }}' |