Update netcore-build #319
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: EasyData.NET Pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
release_mode: | |
description: 'Release mode (none, dev, prod)' | |
required: true | |
default: 'none' | |
release: | |
types: [published] | |
push: | |
branches: | |
- master | |
paths: | |
- .github/workflows/netcore-build.yml | |
- easydata.net/** | |
pull_request: | |
branches: | |
- master | |
- dev | |
paths: | |
- .github/workflows/netcore-build.yml | |
- easydata.net/** | |
jobs: | |
build_and_test: | |
name: Build & Test | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Setup .NET 5 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '5.0.x' | |
- name: Setup .NET Core 3.1 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '3.1.x' | |
- name: Read version.json to env | |
uses: antifree/json-to-variables@v1.0.0 | |
with: | |
filename: ./easydata.net/version.json | |
prefix: ed | |
- name: Setup version in Build.props | |
run: ./tools/SetVersionInCsproj.ps1 ./easydata.net/src/Directory.Build.props ${{ env.ed_packageVersion }} ${{ env.ed_assemblyVersion }} | |
shell: powershell | |
- name: Install dependencies | |
run: dotnet restore EasyData.Dev.sln | |
- name: Build & Pack | |
run: dotnet pack EasyData.sln -o ./easydata.net/packs --configuration Release --no-restore | |
- name: Test | |
run: dotnet test EasyData.Dev.sln --no-restore --verbosity minimal | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: packs | |
path: ./easydata.net/packs/**/*.nupkg | |
release_dev: | |
name: Development Release | |
needs: [ build_and_test ] | |
if: github.event.inputs.release_mode == 'dev' && needs.build_and_test.result == 'success' | |
runs-on: windows-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: packs | |
path: packs | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '5.0.x' | |
- name: Publish packages to MyGet | |
run: dotnet nuget push packs/**/*.nupkg -s https://www.myget.org/F/korzh-nuget/api/v2/package -k ${{ secrets.MYGET_ACCESS_TOKEN }} | |
release_prod: | |
name: Production Release | |
needs: [ build_and_test ] | |
if: (github.event.inputs.release_mode == 'prod' || github.event_name == 'release') && needs.build_and_test.result == 'success' | |
runs-on: windows-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: packs | |
path: packs | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '5.0.x' | |
- name: Publish packages to NuGet | |
run: dotnet nuget push packs/**/*.nupkg -s 'https://api.nuget.org/v3/index.json' -k ${{ secrets.NUGET_ACCESS_TOKEN }} --skip-duplicate | |