Skip to content

ci: add GitHub Actions workflow for build, test, and release #1

ci: add GitHub Actions workflow for build, test, and release

ci: add GitHub Actions workflow for build, test, and release #1

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build-and-test:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET 10 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore RunDialog.slnx
- name: Build solution
run: dotnet build RunDialog.slnx --configuration Release --no-restore
- name: Run tests
run: dotnet test RunDialog.Tests/RunDialog.Tests.csproj --configuration Release --no-build
release:
needs: build-and-test
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || github.event_name == 'workflow_dispatch'
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET 10 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Publish app for win-x64
run: |
dotnet publish RunDialog.App/RunDialog.App.csproj `
-c Release `
-r win-x64 `
--self-contained true `
-p:PublishReadyToRun=true `
-p:PublishTrimmed=true `
-o ./publish/win-x64
- name: Create ZIP archive
run: |
Compress-Archive -Path "./publish/win-x64/*" `
-DestinationPath "./RunDialog-${{ github.ref_name || github.run_id }}-win-x64.zip"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('manual-build-{0}', github.run_number) }}
name: ${{ github.ref_type == 'tag' && github.ref_name || format('RunDialog-manual-build-{0}', github.run_number) }}
files: ./RunDialog-${{ github.ref_name || github.run_id }}-win-x64.zip
generate_release_notes: ${{ github.ref_type == 'tag' }}