Skip to content

Merge branch 'dev' #532

Merge branch 'dev'

Merge branch 'dev' #532

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
test:
name: Unit test
runs-on: ubuntu-latest
steps:
- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --no-build --configuration Release
build:
name: Build
needs: [update-version]
runs-on: ubuntu-latest
steps:
- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack
if: ${{ needs.update-version.outputs.applicable == 'true' || steps.extract_branch.outputs.branch == 'main' }}
run: dotnet pack --configuration Release
- name: Publish project to NuGet
if: ${{ needs.update-version.outputs.applicable == 'true' || steps.extract_branch.outputs.branch == 'main' }}
run: dotnet nuget push '**/*.nupkg' -k ${{secrets.NUGET_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
# - name: Unlist earlier packages of this type
# uses: darenm/unlist-nuget@v1
# with:
# NUGET_PACKAGE: "${{ github.event.repository.name }}"
# VERSION_REGEX: ".*${{needs.update-version.outputs.label}}.*"
# NUGET_KEY: ${{secrets.NUGET_KEY}}
update-version:
needs: [test]
name: Update version
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
outputs:
label: ${{steps.VERSION.outputs.label}}
semver: ${{steps.VERSION.outputs.semver}}
nuget: ${{steps.VERSION.outputs.nuget}}
applicable: ${{steps.VERSION.outputs.applicable}}
steps:
- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout code
uses: actions/checkout@v2
- name: Setup GitVersion
run: dotnet tool install --global GitVersion.Tool
- name: Fetch for GitVersion
run: git fetch --tags --unshallow
- name: Fetch main for GitVersion
if: github.ref != 'refs/heads/main'
run: git branch --create-reflog main origin/main
- name: Update version
run: dotnet-gitversion /updateprojectfiles /updateassemblyinfo /output buildserver
- name: Set job output
id: VERSION
run: |
echo '::set-output name=label::${{env.GitVersion_PreReleaseLabel}}'
echo '::set-output name=semver::${{env.GitVersion_LegacySemVer}}'
echo '::set-output name=nuget::${{env.GitVersion_NuGetPreReleaseTagV2}}'
echo '::set-output name=applicable::${{env.GitVersion_PreReleaseLabel == 'alpha' || env.GitVersion_PreReleaseLabel == 'beta' }}'
- name: Apply changes
if: ${{ steps.VERSION.outputs.applicable == 'true' || steps.extract_branch.outputs.branch == 'main' }}
uses: EndBug/[email protected]
with:
author_name: github-actions[bot]
author_email: github-actions[bot]@users.noreply.github.com
message: "Bumped version to ${{env.GitVersion_LegacySemVer}}"