Skip to content

Add workflow

Add workflow #11

Workflow file for this run

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
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=${{ env.Version }},RoslynatorCliPackageVersion=${{ env.Version }}
- run: dotnet pack --no-build /p:RoslynatorCliVersion=${{ env.Version }},RoslynatorCliPackageVersion=${{ env.Version }}
- uses: actions/upload-artifact@v3
with:
name: nuget_framework_cli
path: src/CommandLine/bin/Release/*
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 }},RoslynatorCliPackageVersion=${{ env.Version }}
- run: dotnet pack --no-build /p:RoslynatorCliVersion=${{ env.Version }},RoslynatorCliPackageVersion=${{ env.Version }}
- uses: actions/upload-artifact@v3
with:
name: nuget_core_cli
path: src/CommandLine/bin/Release/*nupkg