Skip to content

Update dotnet-desktop.yml #165

Update dotnet-desktop.yml

Update dotnet-desktop.yml #165

name: .NET Core Desktop
on:
push:
paths-ignore:
- README.md
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
# - os: ubuntu-latest
# rid: win-x64
# - os: ubuntu-latest
# rid: win-arm64
# - os: ubuntu-latest
# rid: linux-x64
# - os: ubuntu-latest
# rid: linux-arm64
- os: macos-latest
rid: osx-arm64
# - os: macos-latest
# rid: osx-x64
runs-on: ${{ matrix.os }}
env:
APP_NAME: YMouseButtonControl
PROJECT_FOLDER: YMouseButtonControl
PROJECT_NAME: YMouseButtonControl.csproj
CONFIGURATION: Release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Run Csharpier
run: |
dotnet tool restore
dotnet csharpier --check .
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: "5.x"
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
- name: Execute unit tests
run: dotnet test
- name: Restore the application
run: dotnet restore -r ${{ matrix.rid }}
- name: Publish
if: ${{ ! startsWith(matrix.rid, 'osx') }}
run: |
dotnet publish ${{ env.PROJECT_FOLDER}}/${{ env.PROJECT_NAME }} \
-c ${{ env.CONFIGURATION }} \
-r ${{ matrix.rid }} \
-p:Version=${{ steps.gitversion.outputs.SemVer }} \
-p:AssemblyVersion=${{ steps.gitversion.outputs.AssemblySemFileVer }} \
-o bin
- name: Publish
if: ${{ startsWith(matrix.rid, 'osx') }}
run: |
dotnet msbuild ${{ env.PROJECT_FOLDER}}/${{ env.PROJECT_NAME }} \
-t:BundleApp \
-p:RuntimeIdentifier=${{ matrix.rid }} \
-p:UseAppHost=true \
-p:Configuration=${{ env.CONFIGURATION }} \
-p:TargetFramework=net8.0
- name: Set Executable Bit
if: ${{ startsWith(matrix.rid, 'osx') }}
run: chmod -R +x ${{ env.PROJECT_FOLDER}}/bin/${{ env.CONFIGURATION }}/net8.0/${{ matrix.rid }}/publish/${{ env.APP_NAME }}.app
- name: Tar to Preserve Executable Bit
if: ${{ startsWith(matrix.rid, 'osx') }}
run: tar -C ${{ env.PROJECT_FOLDER}}/bin/${{ env.CONFIGURATION }}/net8.0/${{ matrix.rid }}/publish -cvf ${{ env.APP_NAME }}.${{ steps.gitversion.outputs.semVer }}+${{ matrix.rid }}.tar ${{ env.APP_NAME }}.app
- name: Upload build artifacts
if: ${{ startsWith(matrix.rid, 'osx') }}
uses: actions/[email protected]
with:
name: "${{ env.APP_NAME }}.${{ steps.gitversion.outputs.semVer }}+${{ matrix.rid }}"
path: "${{ env.APP_NAME }}.${{ steps.gitversion.outputs.semVer }}+${{ matrix.rid }}.tar"
- name: Upload build artifacts
if: ${{ ! startsWith(matrix.rid, 'osx') }}
uses: actions/[email protected]
with:
name: "${{ env.APP_NAME }}.${{ steps.gitversion.outputs.semVer }}+${{ matrix.rid }}"
path: bin/