Skip to content

Pre-release v1.0.0 alpha #3

Pre-release v1.0.0 alpha

Pre-release v1.0.0 alpha #3

Workflow file for this run

name: pr-ci
on:
pull_request:
types: [opened, reopened, edited, synchronize]
paths-ignore:
- "**/*.gitignore"
- "**/*.gitattributes"
branches:
- master
- develop/**
- pre-release/**
- release/**
jobs:
Run-Lint:
runs-on: ubuntu-latest
env:
github-token: '${{ secrets.GH_Packages }}'
steps:
- name: Step-01 Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Step-02 Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
FILTER_REGEX_INCLUDE: .*src/.*
DEFAULT_BRANCH: master
GITHUB_TOKEN: '${{ env.github-token }}'
Build-Test:
runs-on: ubuntu-latest
outputs:
nuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}
majorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}
fullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}
branchName: ${{ steps.gitversion.outputs.BranchName }}
env:
working-directory: ${{ github.workspace }}
steps:
- name: Step-01 Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- name: Step-02 Check out Code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Step-03 Calculate Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
- name: Step-04 Display Version Info
run: |
echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}"
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}"
echo "BranchName: ${{ steps.gitversion.outputs.BranchName }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
- name: Step-05 Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Step-06 Restore dependencies
run: dotnet restore
working-directory: '${{ env.working-directory }}'
- name: Step-07 Build Version (Beta)
if: ${{ !startsWith(github.head_ref, 'release/') }}
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersion }}
working-directory: '${{ env.working-directory }}'
- name: Step-07 Build Version (Release)
if: ${{ startsWith(github.head_ref, 'release/') }}
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
working-directory: '${{ env.working-directory }}'
- name: Step-08 Test Solution
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
working-directory: '${{ env.working-directory }}'
- name: Step-09 Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: ${{ env.working-directory }}
retention-days: 1
Package:
needs: [Build-Test]
runs-on: ubuntu-latest
env:
github-token: '${{ secrets.GH_Packages }}'
nuget-token: '${{ secrets.NUGET_API_KEY }}'
working-directory: ${{ github.workspace }}
steps:
- name: Step-01 Retrieve Build Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifact
path: ${{ env.working-directory }}
- name: Step-02 Install Github Packages
run: dotnet tool install gpr --global
- name: Step-03 Publish to Github Packages
run: find . -name "*.nupkg" -print -exec gpr push -k ${{ env.github-token }} {} \;
Release:
name: Release to Nuget
needs: [Package]
if: ${{ startsWith(github.head_ref, 'release/') }}
runs-on: ubuntu-latest
env:
nuget-token: '${{ secrets.NUGET_API_KEY }}'
working-directory: ${{ github.workspace }}
steps:
- name: Step-01 Retrieve Build Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifact
path: ${{ env.working-directory }}
- name: Step-02 Release to Nuget Org
run: |
find ${{ env.working-directory }}/src -name "*.nupkg" -path "*/Release/*.nupkg" -exec dotnet nuget push {} --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json \;