Add GitHub workflow

This commit is contained in:
Kamil Trzciński 2022-11-12 14:48:40 +01:00
parent fb67090f44
commit 4e38168b3a

66
.github/workflows/build.yaml vendored Normal file
View file

@ -0,0 +1,66 @@
on:
push:
branches: [main]
pull_request:
release:
types: [published]
env:
DOTNET_VERSION: '6.0.x'
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
if: github.ref_type != 'tag'
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dependencies
run: dotnet restore
- name: Build without Version
run: dotnet build --configuration Release --output FanControl-develop/
- name: Test
run: dotnet test --no-restore --verbosity normal
- uses: vimtor/action-zip@v1
with:
files: FanControl-develop/
dest: FanControl-develop.zip
build-and-release:
runs-on: ${{ matrix.os }}
if: github.ref_type == 'tag'
permissions:
contents: write
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dependencies
run: dotnet restore
- name: Build with Version
run: dotnet build --configuration Release /property:Version=${{ github.event.release.tag_name }} --output FanControl-${{ github.event.release.tag_name }}/
- name: Test
run: dotnet test --no-restore --verbosity normal
- uses: vimtor/action-zip@v1
with:
files: FanControl-${{ github.event.release.tag_name }}/
dest: FanControl-${{ github.event.release.tag_name }}.zip
- uses: ncipollo/release-action@v1
with:
artifacts: "*.zip"
prerelease: true
allowUpdates: true
generateReleaseNotes: true
omitNameDuringUpdate: true
updateOnlyUnreleased: true