Files
TimetableDesigner/.gitea/workflows/build_test_publish.yml

93 lines
2.8 KiB
YAML

name: Build, test and publish app
on:
workflow_dispatch:
branches:
- "main"
push:
branches:
- "main"
paths:
- "TimetableDesigner**"
jobs:
build_test_version:
name: Build, test and determine version
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test
- name: Setup GitVersion
uses: gittools/actions/gitversion/setup@v4.2.0
with:
versionSpec: 6.4.x
- name: Determine version
uses: gittools/actions/gitversion/execute@v4.2.0
id: gitversion
with:
configFilePath: ./.gitea/config/gitversion.yml
outputs:
version: ${{ steps.gitversion.outputs.SemVer }}
pack:
name: Pack
needs: build_test_version
strategy:
matrix:
platform: [x64, x86]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Publish
run: dotnet publish -c Release -r win-${{ matrix.platform }} --self-contained true -p:PublishSingleFile=true -p:Version=${{needs.build_test_version.outputs.version}} TimetableDesigner\\TimetableDesigner.csproj
- name: Create .ZIP archive
id: archive
uses: ksm2/archive-action@v1
with:
format: "zip"
name: timetable_designer_${{needs.build_test_version.outputs.version}}_${{ matrix.platform }}
root-directory: TimetableDesigner/bin/Release/net7.0-windows/win-${{ matrix.platform }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}
path: ${{ steps.archive.outputs.path }}
outputs:
version: ${{needs.build_test_version.outputs.version}}
publish:
name: Publish
needs: pack
steps:
- name: Download x64 artifact
uses: actions/download-artifact@v3
with:
name: x64
path: ${{ github.workspace}}
- name: Download x86 artifact
uses: actions/download-artifact@v3
with:
name: x86
path: ${{ github.workspace}}
- name: Create Release
uses: akkuman/gitea-release-action@v1
with:
tag_name: ${{needs.pack.outputs.version}}
name: ${{needs.pack.outputs.version}}
files: |-
timetable_designer_${{needs.pack.outputs.version}}_x64.zip
timetable_designer_${{needs.pack.outputs.version}}_x86.zip