feat: update MsgPack.Light & CI #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, Test & Publish nuget | |
on: | |
push: | |
branches: [ "master" ] | |
tags: ['*'] | |
pull_request: | |
types: [ opened, synchronize ] | |
branches: [ "master" ] | |
env: | |
NuGetDirectory: ${{ github.workspace }}/nuget | |
jobs: | |
build_test_and_pack: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetches entire history, so we can analyze commits since last tag | |
- name: Setup .net core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
3.1.x | |
6.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Release --no-restore | |
- name: Docker build | |
run: docker-compose build | |
- name: Docker pull | |
run: docker-compose pull | |
- name: Docker-compose run | |
run: docker-compose up -d | |
- name: Tests | |
run: dotnet test -c Release --no-build --verbosity normal | |
- name: Pack nuget | |
if: success() | |
run: | | |
set +x | |
NUGET_VERSION=$(git describe --tags --abbrev=1 | sed 's/-/./') | |
dotnet pack -c Release --no-build -v minimal -o ${{ env.NuGetDirectory }} -p:PackageVersion=$NUGET_VERSION | |
- name: Publish NuGet package | |
if: success() && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) | |
run: dotnet nuget push "${{ env.NuGetDirectory }}/*.nupkg" --api-key "${{ secrets.NUGET_PUSH }}" --source https://api.nuget.org/v3/index.json --skip-duplicate | |
- name: Upload files to a GitHub release | |
if: success() && github.ref_type == 'tag' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) | |
uses: xresloader/[email protected] | |
with: | |
file: ${{ env.NuGetDirectory }}/*.nupkg | |
tags: true | |
overwrite: true | |
tag_name: ${{ github.ref_name }} |