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+ 14+ - name : Setup .NET Core SDK
15+ 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 }}
0 commit comments