Skip to content

Commit 80960d3

Browse files
authored
Merge pull request #13 from nor0x/CICD
macOS build pipeline
2 parents 640136e + 5797d0b commit 80960d3

File tree

2 files changed

+159
-7
lines changed

2 files changed

+159
-7
lines changed

.github/workflows/release.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build-macos:
10+
runs-on: macos-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/[email protected]
14+
- name: Setup .NET Core SDK
15+
uses: actions/[email protected]
16+
with:
17+
# Optional SDK version(s) to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x
18+
dotnet-version: '7.0.x'
19+
include-prerelease: true
20+
- name: Install the Apple certificate and provisioning profile
21+
env:
22+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
23+
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
24+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
25+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
26+
run: |
27+
# create variables
28+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
29+
PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
30+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
31+
32+
# import certificate and provisioning profile from secrets
33+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
34+
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
35+
36+
# create temporary keychain
37+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
38+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
39+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
40+
41+
# import certificate to keychain
42+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
43+
security list-keychain -d user -s $KEYCHAIN_PATH
44+
45+
# apply provisioning profile
46+
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
47+
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
48+
49+
- name: run build scripts
50+
run: |
51+
cd $GITHUB_WORKSPACE/src
52+
dotnet workload restore
53+
dotnet publish -f:net7.0-maccatalyst -c:Release
54+
cd $GITHUB_WORKSPACE/src/bin/Release/net7.0-maccatalyst/
55+
ditto -c -k --sequesterRsrc --keepParent Dots.app Dots.app.zip
56+
57+
- uses: actions/upload-artifact@v3
58+
with:
59+
name: macOS
60+
path: ${{ github.workspace }}/src/bin/Release/net7.0-maccatalyst/Dots.app.zip
61+
62+
# build-windows:
63+
# runs-on: windows-latest # For a list of available runner types, refer to
64+
65+
# steps:
66+
# - name: Checkout
67+
# uses: actions/checkout@v3
68+
# with:
69+
# fetch-depth: 0
70+
71+
# # Install the .NET Core workload
72+
# - name: Install .NET Core
73+
# uses: actions/setup-dotnet@v2
74+
# with:
75+
# dotnet-version: 6.0.300-preview.22204.3
76+
77+
# # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
78+
# - name: Setup MSBuild.exe
79+
# uses: microsoft/[email protected]
80+
81+
82+
# # Decode the base 64 encoded pfx and save the Signing_Certificate
83+
# - name: Decode the pfx
84+
# run: |
85+
# cd $env:GITHUB_WORKSPACE
86+
# $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
87+
# $certificatePath = Join-Path -Path $env:GITHUB_WORKSPACE\Dots -ChildPath GitHubActionsWorkflow.pfx
88+
# [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
89+
# $SecurePassword = ConvertTo-SecureString ${{ secrets.Pfx_Key }} –asplaintext –force
90+
# Get-ChildItem -Path $env:GITHUB_WORKSPACE\Dots\GitHubActionsWorkflow.pfx | Import-PfxCertificate -CertStoreLocation Cert:\CurrentUser\My -Password $SecurePassword
91+
92+
# # Decode the base 64 encoded pfx and save the Signing_Certificate
93+
# - name: Build the app
94+
# run: |
95+
# dotnet workload install maui-windows
96+
# dotnet workload restore
97+
# cd $env:GITHUB_WORKSPACE/Dots
98+
# msbuild /restore /t:Publish /p:TargetFramework=net6.0-windows10.0.19041 /p:configuration=Release
99+
100+
# - name: Find and Prepare MSIX
101+
# run: |
102+
# cd $env:GITHUB_WORKSPACE/Dots
103+
# ls
104+
# Get-ChildItem -Path ".\" -Include Dots*.msix -Recurse | Copy-Item -Destination .\
105+
# ls
106+
# get-childitem -Path $dir | where-object { $_.Name -like "Dots*.msix" } | %{ rename-item -LiteralPath $_.FullName -NewName "$d`Dots.msix" }
107+
# ls
108+
109+
# - uses: actions/upload-artifact@v3
110+
# with:
111+
# name: Windows
112+
# path: ${{ github.workspace }}/Dots/Dots.msix
113+
114+
create-release:
115+
#needs: [build-macos, build-windows]
116+
needs: [build-macos]
117+
runs-on: ubuntu-latest
118+
steps:
119+
- uses: actions/download-artifact@v3
120+
with:
121+
name: macOS
122+
path: $GITHUB_WORKSPACE
123+
124+
# - uses: actions/download-artifact@v3
125+
# with:
126+
# name: Windows
127+
# path: $GITHUB_WORKSPACE
128+
129+
- name: Display structure of downloaded files
130+
run: |
131+
cd $GITHUB_WORKSPACE
132+
ls
133+
134+
# You may pin to the exact commit or the version.
135+
# uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01
136+
- uses: ncipollo/[email protected]
137+
with:
138+
artifacts: "$GITHUB_WORKSPACE/Dots.app.zip"
139+
token: ${{ secrets.GITHUB_TOKEN }}

src/Dots.csproj

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,49 @@
1313
<ApplicationTitle>Dots</ApplicationTitle>
1414

1515
<!-- App Identifier -->
16-
<ApplicationId>com.companyname.dots</ApplicationId>
16+
<ApplicationId>com.nor0x.dots</ApplicationId>
1717
<ApplicationIdGuid>87c84e14-38b5-4b30-beca-ae34d453cb49</ApplicationIdGuid>
1818

1919
<!-- Versions -->
20-
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
21-
<ApplicationVersion>1</ApplicationVersion>
20+
<ApplicationDisplayVersion>0.0.1</ApplicationDisplayVersion>
21+
<ApplicationVersion>0.0.1</ApplicationVersion>
2222

2323
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
2424
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
2525
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
26-
<WindowsPackageType>MSIX</WindowsPackageType>
2726
</PropertyGroup>
2827

2928
<!-- WINDOWS PUBLISHING Condition Release-->
3029
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('windows'))">
3130
<OutputType>WinExe</OutputType>
31+
<WindowsPackageType>MSIX</WindowsPackageType>
3232
</PropertyGroup>
33-
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
33+
<PropertyGroup Condition="'$(Configuration)' == 'Release' AND $([MSBuild]::IsOSPlatform('windows'))">
3434
<SelfContained>true</SelfContained>
3535
<WindowsAppSdkSelfContained>true</WindowsAppSdkSelfContained>
3636
<PublishReadyToRun>true</PublishReadyToRun>
3737
<WindowsPackageType>None</WindowsPackageType>
3838
</PropertyGroup>
3939

40+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-maccatalyst|AnyCPU'">
41+
<CreatePackage>false</CreatePackage>
42+
<CodesignKey>Mac Developer</CodesignKey>
43+
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
44+
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
45+
</PropertyGroup>
46+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-maccatalyst|AnyCPU'">
47+
<CreatePackage>false</CreatePackage>
48+
<CodesignProvision>dots-profile</CodesignProvision>
49+
<CodesignKey>Developer ID Application</CodesignKey>
50+
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
51+
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
52+
</PropertyGroup>
4053
<ItemGroup>
4154
<!-- App Icon -->
42-
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
55+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#38343d" />
4356

4457
<!-- Splash Screen -->
45-
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
58+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#38343d" BaseSize="128,128" />
4659

4760
<!-- Images -->
4861
<MauiImage Include="Resources\Images\*" />

0 commit comments

Comments
 (0)