character-records-generator/.github/workflows/dotnet-build-test.yml
2022-07-25 22:35:26 +01:00

65 lines
1.9 KiB
YAML

name: ci build and test
on:
push:
branches: [ "master" ]
tags:
- 'v*'
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: windows-latest
env:
Solution_Name: CharacterRecordsGenerator.sln
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Add MSBuild to path
uses: microsoft/setup-msbuild@v1.1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
- name: Restore nuget
run: nuget restore $env:Solution_Name
- name: Build
run: msbuild $env:Solution_Name /t:Rebuild -property:Configuration=Release
- name: Unit tests
run: dotnet test --no-build --verbosity normal
- name: Archive
uses: actions/upload-artifact@v3
with:
name: character-records-generator
path: |
CharacterRecordsGenerator/bin/Release/*.exe
CharacterRecordsGenerator/bin/Release/*.dll
deploy:
name: Create release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- uses: actions/download-artifact@v3
with:
name: character-records-generator
- name: Upload character-records-generator
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./character-records-generator
asset_name: character-records-generator.zip
asset_content_type: application/zip