Skip to content

Compact code

Compact code #2160

Workflow file for this run

name: .NET Core
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
7.0.x
- name: Restore
run: git submodule update --init --recursive
- name: Build with dotnet
run: dotnet build build.proj --configuration Release
- name: Set Timezone
uses: szenius/set-timezone@v1.2
with:
timezoneWindows: "Nepal Standard Time"
- name: Test with dotnet
run: dotnet test build.proj -v n
package:
runs-on: windows-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
7.0.x
6.0.x
- name: Restore
run: git submodule update --init --recursive
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Setup Version Suffix
shell: pwsh
run: |
$buildId = $env:GITHUB_RUN_NUMBER.PadLeft(5, '0');
$versionSuffixPR = "PR${{ github.event.pull_request.number }}-$buildId";
$branchName = "${{ steps.extract_branch.outputs.branch }}".Replace("_","").Replace("/","-");
$versionSuffixBRANCH = "$($branchName)-CI$($buildId)"
$env:VersionSuffix = if ("${{ github.event.pull_request.number }}") { $versionSuffixPR } else { $versionSuffixBRANCH }
Write-Output "##[set-output name=version_suffix]$($env:VersionSuffix)"
id: version_suffix
- name: Package
run: dotnet pack build.proj --version-suffix ${{ steps.version_suffix.outputs.version_suffix }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: nupkg-${{ matrix.runs-on }}
path: ./bin/nupkg/*.nupkg
- name: Push to GitHub Feed
continue-on-error: true
shell: bash
run: |
for f in ./bin/nupkg/*.nupkg
do
echo $f
dotnet nuget push $f -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
done
docs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
7.0.x
6.0.x
5.0.x
- name: Restore
run: git submodule update --init --recursive
- name: Build All Docs
run: dotnet msbuild -target:AllDocs build.proj