-
-
Notifications
You must be signed in to change notification settings - Fork 4
239 lines (205 loc) · 12.8 KB
/
pre_release_debug.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: pre_release_debug
on:
workflow_dispatch:
push:
tags:
- prereleases/[0-9]+.[0-9]+.[0-9]+
- prereleases/[0-9]+.[0-9]+.[0-9]+.[0-9]+
permissions:
contents: write
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get the version
id: get_version
uses: mavrosxristoforos/get-xml-info@1.0
with:
xml-file: './Directory.Build.props'
xpath: '//Version'
- name: Get changelog
id: get_changelog
run: |
./get-changelog.ps1 -currentVersion "${{ steps.get_version.outputs.info }}"
shell: pwsh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: prerelease/${{ steps.get_version.outputs.info }}
release_name: ${{ steps.get_version.outputs.info }}
draft: false
prerelease: true
body_path: ./version-changelog.md
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.info }}
build_win:
runs-on: windows-2022
needs: create_release
env:
RID: win-x64
steps:
- uses: actions/checkout@v3
- name: Restore dependencies
run: dotnet restore -r ${{ env.RID }}
- name: Use release route repositories
shell: pwsh
run: |
cp src/RoadCaptain.App.Runner/appsettings.routerepositories.release.json src/RoadCaptain.App.Runner/appsettings.routerepositories.json
cp src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.release.json src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.json
- name: Test
run: dotnet test --verbosity minimal -c Debug -r ${{ env.RID }} -p:RuntimeIdentifier=${{ env.RID }} -p:RuntimeIdentifiers=${{ env.RID }}
- name: Publish Runner
# Because of reasons we need to explicitly set RuntimeIdentifiers to only win-x64 because MSBuild sets it to osx-x64;win-x64
run: dotnet publish --self-contained -c Debug -r ${{ env.RID }} -p:RuntimeIdentifiers=${{ env.RID }} -p:PreRelease=True src\RoadCaptain.App.Runner\RoadCaptain.App.Runner.csproj
- name: Publish RouteBuilder
run: dotnet publish --self-contained -c Debug -r ${{ env.RID }} -p:RuntimeIdentifiers=${{ env.RID }} -p:PreRelease=True src\RoadCaptain.App.RouteBuilder\RoadCaptain.App.RouteBuilder.csproj
- name: Update Wix components file
run: dotnet run --project .\packaging\RoadCaptain.WixComponentFileGenerator\RoadCaptain.WixComponentFileGenerator.csproj src\RoadCaptain.App.Runner\bin\Debug\net6.0-windows\${{ env.RID }}\publish src\RoadCaptain.App.RouteBuilder\bin\Debug\net6.0-windows\${{ env.RID }}\publish .\packaging\RoadCaptain.Installer\Components.wxi
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Build MSI
# Note: The trailing slash at the end of RunnerTargetDir and RouteBuilderTargetDir is mandatory, otherwise building the MSI fails!
run: msbuild .\packaging\RoadCaptain.Installer\RoadCaptain.Installer.wixproj -property:Configuration=Debug -property:RunnerTargetDir=D:\a\RoadCaptain\RoadCaptain\src\RoadCaptain.App.Runner\bin\Debug\net6.0-windows\${{ env.RID }}\publish\ -property:RouteBuilderTargetDir=D:\a\RoadCaptain\RoadCaptain\src\RoadCaptain.App.RouteBuilder\bin\Debug\net6.0-windows\${{ env.RID }}\publish\ -property:PreRelease=True
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: D:\a\RoadCaptain\RoadCaptain\packaging\RoadCaptain.Installer\bin\Debug\RoadCaptain_${{ needs.create_release.outputs.version }}.msi
asset_name: RoadCaptain_${{ needs.create_release.outputs.version }}.msi
asset_content_type: application/x-msi
build_macos-x64:
runs-on: macos-11
needs: create_release
env:
TEAM_ID: 44HHP3V8VR
SIGNING_IDENTITY: "Developer ID Application: Codenizer BV (44HHP3V8VR)" # matches Keychain Access certificate name
RID: osx-x64
steps:
- uses: actions/checkout@v3
- name: Use release route repositories
shell: bash
run: |
cp src/RoadCaptain.App.Runner/appsettings.routerepositories.release.json src/RoadCaptain.App.Runner/appsettings.routerepositories.json
cp src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.release.json src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.json
- name: Import signing certificate and set up keychain
run: |
# Set up new build keychain
security create-keychain -p "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
# Decode certificate to file
echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 --decode > certificate.p12
security import certificate.p12 -k build.keychain -P "${{ secrets.MACOS_CERTIFICATE_PWD}}" -T /usr/bin/codesign
# Allow codesign to access keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
# Add app password for notarytool
xcrun notarytool store-credentials "AC_PASSWORD" --apple-id "${{ secrets.APPLE_ID }}" --team-id ${{ env.TEAM_ID }} --password "${{ secrets.NOTARY_TOOL_PASSWORD }}"
- name: Build and package Runner
run: |
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
VERSION=$(grep Version Directory.Build.props | sed -e 's/<Version>//g' -e 's/<\/Version>//g' | tr -d '\t ')
./packaging/build-macos-app "$PUBLISH_DIR" "$VERSION" "Runner" "${{ env.SIGNING_IDENTITY }}" "${{ env.RID }}" "Debug" "PreRelease"
- name: Build and package RouteBuilder
run: |
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
VERSION=$(grep Version Directory.Build.props | sed -e 's/<Version>//g' -e 's/<\/Version>//g' | tr -d '\t ')
./packaging/build-macos-app "$PUBLISH_DIR" "$VERSION" "RouteBuilder" "${{ env.SIGNING_IDENTITY }}" "${{ env.RID }}" "Debug" "PreRelease"
- name: Create DMG
run: |
VERSION=`echo ${{ needs.create_release.outputs.version }} | tr -d '\n'`
DISK_IMAGE="$RUNNER_TEMP/RoadCaptain-$VERSION-${{ env.RID }}.dmg"
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
chmod +x ./packaging/create-dmg
./packaging/create-dmg --volname "RoadCaptain $VERSION" --volicon ./src/RoadCaptain.App.Shared/icon.icns --window-pos 200 120 --window-size 800 533 --icon-size 128 --icon "RoadCaptain RouteBuilder.app" 200 40 --icon "RoadCaptain Runner.app" 200 260 --app-drop-link 600 40 --background "./src/RoadCaptain.App.Shared/Assets/installer-background.jpg" --codesign A357F29F30B7179DCBA515D2A6ECE77620951CBD "$DISK_IMAGE" "$PUBLISH_DIR"
# Notarize disk image
xcrun notarytool submit "$DISK_IMAGE" --keychain-profile "AC_PASSWORD" --wait
xcrun stapler staple "$DISK_IMAGE"
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: "/Users/runner/work/_temp/RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg" # Explicit path here because $RUNNER_TEMP doesn't get expanded...
asset_name: RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg
asset_content_type: application/x-apple-diskimage
build_macos-arm64:
runs-on: macos-11
needs: create_release
if: ${{ false }} # disable until we resolve the webview packaging issue for arm64
env:
TEAM_ID: 44HHP3V8VR
SIGNING_IDENTITY: "Developer ID Application: Codenizer BV (44HHP3V8VR)" # matches Keychain Access certificate name
RID: osx-arm64
steps:
- uses: actions/checkout@v3
- name: Use release route repositories
shell: bash
run: |
cp src/RoadCaptain.App.Runner/appsettings.routerepositories.release.json src/RoadCaptain.App.Runner/appsettings.routerepositories.json
cp src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.release.json src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.json
- name: Import signing certificate and set up keychain
run: |
# Set up new build keychain
security create-keychain -p "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
# Decode certificate to file
echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 --decode > certificate.p12
security import certificate.p12 -k build.keychain -P "${{ secrets.MACOS_CERTIFICATE_PWD}}" -T /usr/bin/codesign
# Allow codesign to access keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
# Add app password for notarytool
xcrun notarytool store-credentials "AC_PASSWORD" --apple-id "${{ secrets.APPLE_ID }}" --team-id ${{ env.TEAM_ID }} --password "${{ secrets.NOTARY_TOOL_PASSWORD }}"
- name: Build and package Runner
run: |
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
VERSION=$(grep Version Directory.Build.props | sed -e 's/<Version>//g' -e 's/<\/Version>//g' | tr -d '\t ')
./packaging/build-macos-app "$PUBLISH_DIR" "$VERSION" "Runner" "${{ env.SIGNING_IDENTITY }}" "${{ env.RID }}" "Debug" "PreRelease"
- name: Build and package RouteBuilder
run: |
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
VERSION=$(grep Version Directory.Build.props | sed -e 's/<Version>//g' -e 's/<\/Version>//g' | tr -d '\t ')
./packaging/build-macos-app "$PUBLISH_DIR" "$VERSION" "RouteBuilder" "${{ env.SIGNING_IDENTITY }}" "${{ env.RID }}" "Debug" "PreRelease"
- name: Create DMG
run: |
VERSION=`echo ${{ needs.create_release.outputs.version }} | tr -d '\n'`
DISK_IMAGE="$RUNNER_TEMP/RoadCaptain-$VERSION-${{ env.RID }}.dmg"
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
chmod +x ./packaging/create-dmg
./packaging/create-dmg --volname "RoadCaptain $VERSION" --volicon ./src/RoadCaptain.App.Shared/icon.icns --window-pos 200 120 --window-size 800 533 --icon-size 128 --icon "RoadCaptain RouteBuilder.app" 200 40 --icon "RoadCaptain Runner.app" 200 260 --app-drop-link 600 40 --background "./src/RoadCaptain.App.Shared/Assets/installer-background.jpg" --codesign A357F29F30B7179DCBA515D2A6ECE77620951CBD "$DISK_IMAGE" "$PUBLISH_DIR"
# Notarize disk image
xcrun notarytool submit "$DISK_IMAGE" --keychain-profile "AC_PASSWORD" --wait
xcrun stapler staple "$DISK_IMAGE"
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: "/Users/runner/work/_temp/RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg" # Explicit path here because $RUNNER_TEMP doesn't get expanded...
asset_name: RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg
asset_content_type: application/x-apple-diskimage
update_site_releases:
runs-on: ubuntu-latest
needs: [create_release, build_win, build_macos-x64, build_macos-arm64]
steps:
- uses: actions/checkout@v3
- name: Replace pre-release version
shell: bash
run: |
previous_version=`sed -nr "s/.*prerelease%2F([0-9]\.[0-9]*\.[0-9]*\.[0-9]*).*$/\1/p" site/data/releases.yml | head -n 1`
sed -i "s/$previous_version/${{needs.create_release.outputs.version}}/g" site/data/releases.yml
git add site/data/releases.yml
git commit -m "Update pre-release version on website"
git push