Skip to content

Commit

Permalink
ワークフローを仮設置
Browse files Browse the repository at this point in the history
  • Loading branch information
r-koubou committed Nov 17, 2023
1 parent 12816b4 commit 2044f15
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 2 deletions.
35 changes: 33 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
build-app-kind:
required: false
type: string
default: "CLI, WPF"
default: "CLI, WPF, Xamarin.Mac"
build-configuration:
required: true
type: string
Expand All @@ -23,7 +23,7 @@ on:
description: "Kind of Application"
required: false
type: string
default: "CLI, WPF"
default: "CLI, WPF, Xamarin.Mac"
build-configuration:
description: "Build configuration for msbuild"
required: true
Expand Down Expand Up @@ -99,3 +99,34 @@ jobs:
with:
name: KeySwitchManager.WPF-${{ inputs.build-configuration }}${{ inputs.custom-suffix }}-${{ github.sha }}
path: ${{ github.workspace }}/publish/KeySwitchManager.WPF*/

#--------------------------------------------------------------
# WPF
#--------------------------------------------------------------
xmarin-mac-build:
if: contains(inputs.build-app-kind, 'Xamarin.Mac')
runs-on: macos-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}

- name: Xamarin.Mac Build
run: dotnet msbuild /nologo /t:Archive /p:Configuration=${{ inputs.build-configuration }} /p:PublishDir=${{ github.workspace }}/publish $ProjectFile
shell: bash
env:
ProjectFile: KeySwitchManager/Sources/Runtime/Applications/WPF/publish.msbuild

- name: Artifact Xamarin.Mac
uses: actions/upload-artifact@v3
with:
name: KeySwitchManager.Xamarin.Mac-${{ inputs.build-configuration }}${{ inputs.custom-suffix }}-${{ github.sha }}
path: ${{ github.workspace }}/publish/KeySwitchManager.Xamarin.Mac*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<Project>

<PropertyGroup>
<ProjectName>KeySwitchManager.Xamarin.Mac</ProjectName>
<ProjectFile>Applications.Xamarin.Mac.csproj</ProjectFile>
<BuildDate>$([System.DateTime]::Now.ToString("yyyyMMdd"))</BuildDate>
</PropertyGroup>

<Target Name="Initialize">
<!-- Build for Specific OS native code -->
<PropertyGroup Condition="$(RID) != ''">
<Prefix>$(ProjectName)-$(RID)</Prefix>
<ForDotNetCore>false</ForDotNetCore>
</PropertyGroup>
<!-- Build for .net Core code -->
<PropertyGroup Condition="$(RID) == ''">
<Prefix>$(ProjectName)</Prefix>
<ForDotNetCore>true</ForDotNetCore>
</PropertyGroup>

<PropertyGroup>
<PublishWorkDir>$(PublishDir)/$(Prefix)</PublishWorkDir>
</PropertyGroup>

<!--#region Value check -->
<Error
Condition="$(Configuration) == ''"
Text="Property: `Configuration` is not set."/>
<Error
Condition="$(ProjectName) == ''"
Text="Property: `ProjectName` is not set."/>
<Error
Condition="$(ProjectFile) == ''"
Text="Property: `ProjectFile` is not set."/>
<Error
Condition="$(PublishDir) == ''"
Text="Property: `PublishDir` is not set."/>
<!--#endregion-->

</Target>

<Target Name="Build" DependsOnTargets="Initialize">

<!-- Build for Specific OS native code -->
<PropertyGroup Condition="$(ForDotNetCore) == 'false'">
<PropertyArgs>
OutDir=$(PublishWorkDir);PublishDir=$(PublishWorkDir);Configuration=$(Configuration);SelfContained=true;RuntimeIdentifier=$(RID)
</PropertyArgs>
</PropertyGroup>
<!-- Build for .net Core code -->
<PropertyGroup Condition="$(ForDotNetCore) == 'true'">
<PropertyArgs>
OutDir=$(PublishWorkDir);PublishDir=$(PublishWorkDir);Configuration=$(Configuration)
</PropertyArgs>
</PropertyGroup>

<MSBuild
Projects="$(ProjectFile)"
Targets="restore;publish"
Properties="$(PropertyArgs)"/>

</Target>

<Target Name="Archive" DependsOnTargets="Build">

<Copy
SourceFiles="VERSION.md"
DestinationFolder="$(PublishWorkDir)"
ContinueOnError="true" />

<ZipDirectory
Condition="'$(EnableArchive)'==true"
SourceDirectory="$(PublishWorkDir)"
DestinationFile="$(PublishDir)/$(Prefix)-$(BuildDate).zip"
Overwrite="true" />
<RemoveDir
Condition="'$(EnableArchive)'==true"
Directories="$(PublishWorkDir)/"/>
</Target>

</Project>

0 comments on commit 2044f15

Please sign in to comment.