Skip to content

πŸ› Fix CI variables #34

πŸ› Fix CI variables

πŸ› Fix CI variables #34

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full depth (not shallow) for GitVersion and better relevancy of Sonar analysis
- name: Set up GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 6.x
- name: Execute GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
additionalArguments: /updateprojectfiles
- name: Set nupkg path (GitVersion-ed)
run: |
echo 'NUPKG_PATH=artifacts/package/release/${{ github.event.repository.name }}.${{ env.GitVersion_SemVer }}.nupkg' >> "$GITHUB_ENV"
- name: Use .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
# Begin ci-build.ps1
- name: dotnet restore
run: dotnet restore
- name: dotnet build
run: dotnet build -c release --no-restore
- name: dotnet pack
run: dotnet pack -c release --no-build
# End ci-build.ps1
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: dotnet nuget push
if: ${{ github.ref == 'refs/heads/main' }}
run: >-
dotnet nuget push ${{ env.NUPKG_PATH }}
--api-key $NUGET_AUTH_TOKEN
--no-symbols
--source https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}
- uses: gittools/actions/gitreleasemanager/[email protected]
if: ${{ github.ref == 'refs/heads/main' }}
name: Create release (GitReleaseManager)
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
repository: ${{ github.event.repository.name }}
milestone: ${{ env.GitVersion_SemVer }}
name: v${{ env.GitVersion_SemVer }}
assets: |
${{ env.NUPKG_PATH }}