Add workflow #16
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
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
jobs: | |
before_build: | |
runs-on: ubuntu-20.04 | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Update path | |
run: echo ":/github/home/.dotnet/tools" >> $GITHUB_PATH | |
- run: dotnet tool install -g GitVersion.Tool --version 5.10.1 --ignore-failed-sources | |
- run: dotnet tool install -g dotnet-validate --version 0.0.1-preview.304 | |
- name: Resolve version | |
id: version | |
run: | | |
dotnet-gitversion > version.json | |
version="$(jq -r '.SemVer' version.json)" | |
pr_version="$(jq -r '.MajorMinorPatch' version.json)-$(jq -r '.PreReleaseLabel' version.json).${{ github.run_number }}.${{ github.run_attempt }}" | |
if [ "${{ github.event_name }}" = "pull_request" ]; then version=$pr_version; fi | |
echo "Resolved version: $version" | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
build_framework_cli: | |
needs: before_build | |
runs-on: windows-latest | |
env: | |
Configuration: Release | |
TreatWarningsAsErrors: true | |
WarningsNotAsErrors: 1591,NU5128 | |
RoslynatorCommandLine: true | |
Deterministic: true | |
defaults: | |
run: | |
working-directory: src/CommandLine | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Resolve version | |
run: | | |
$version="${{ needs.before_build.outputs.version }}" | |
echo "Resolved version: $version" | |
echo "Version=$version" >> $GITHUB_ENV | |
- run: dotnet restore | |
- run: dotnet publish --no-restore /p:RoslynatorCliVersion=${{ needs.before_build.outputs.version }} | |
- run: dotnet pack --no-build /p:RoslynatorCliPackageVersion=${{ needs.before_build.outputs.version }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nuget_packages | |
path: src/CommandLine/bin/Release/*nupkg | |
build_core_cli: | |
needs: before_build | |
runs-on: ubuntu-20.04 | |
env: | |
Configuration: Release | |
TreatWarningsAsErrors: true | |
WarningsNotAsErrors: 1591 | |
RoslynatorDotNetCli: true | |
Deterministic: true | |
defaults: | |
run: | |
working-directory: src/CommandLine | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Resolve version | |
run: | | |
version="${{ needs.before_build.outputs.version }}" | |
echo "Resolved version: $version" | |
echo "Version=$version" >> $GITHUB_ENV | |
- run: dotnet restore | |
- run: dotnet build --no-restore /p:RoslynatorCliVersion=${{ env.Version }} | |
- run: dotnet pack --no-build /p:RoslynatorCliPackageVersion=${{ env.Version }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nuget_packages | |
path: src/CommandLine/bin/Release/*nupkg | |
build_client_lib_and_testing: | |
needs: before_build | |
runs-on: ubuntu-20.04 | |
env: | |
Configuration: Release | |
TreatWarningsAsErrors: true | |
WarningsNotAsErrors: 1591 | |
Deterministic: true | |
defaults: | |
run: | |
working-directory: src | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Resolve version | |
run: | | |
version="${{ needs.before_build.outputs.version }}" | |
echo "Resolved version: $version" | |
echo "Version=$version" >> $GITHUB_ENV | |
- run: dotnet restore Roslynator.ClientLibAndTesting.slnf | |
- run: dotnet build Roslynator.ClientLibAndTesting.slnf --no-restore | |
- run: dotnet pack Roslynator.ClientLibAndTesting.slnf --no-build -o _nupkg | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nuget_packages | |
path: src/_nupkg/*nupkg |