-
Notifications
You must be signed in to change notification settings - Fork 15
236 lines (208 loc) · 7.95 KB
/
release.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
name: Release
on:
workflow_dispatch:
inputs:
flag:
description: "Publish to Microsoft Store"
required: true
default: false
type: boolean
tag1:
description: "Is beta?"
required: true
default: "v"
type: choice
options:
- beta
- v
tag2:
description: "Version (e.g 2.0.0.6):"
required: true
type: string
jobs:
# Reuse the build job from build.yml
build:
name: Build
uses: ./.github/workflows/build.yml
with:
create_package: true
secrets:
pfx_base64_encoded: ${{ secrets.PFX_BASE64_ENCODED }}
release:
name: Create .msixbundle
needs: build
runs-on: windows-latest
env:
SigningKey_Path: SigningKey.pfx
Artifacts_Path: .artifacts
steps:
- name: Download .msix from artifacts
uses: actions/download-artifact@v4
with:
name: .msix
path: ${{ env.Artifacts_Path }}
- name: Get Package Information
id: get_package_info
run: |
# Get the name of the .msix file
$file = Get-Item -Path "${{ env.Artifacts_Path }}\*.msix"
if ($file -is [array]) {
$file = $file[0]
}
# Extract the package name with version number
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.FullName)
$bundleFileName = $fileName -replace '^(.*?Natsurainko\.FluentLauncher)_(\d+\.\d+\.\d+\.\d+)(_x64|_arm64)$', '$1_$2.msixbundle'
$version = $fileName -replace '^(.*?Natsurainko\.FluentLauncher)_(\d+\.\d+\.\d+\.\d+)(_x64|_arm64)$', '$2'
echo "::set-output name=bundleFileName::$bundleFileName"
echo "::set-output name=version::$version"
- name: Create .msixbundle
run: |
# Get makeappx.exe
$makeappx = Get-Item -Path "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\makeappx.exe"
if ($makeappx -is [array]) {
$makeappx = $makeappx[0]
}
# Create the .msixbundle using makeappx.exe
& $makeappx.FullName bundle /d "${{ env.Artifacts_Path }}" /p "${{ steps.get_package_info.outputs.bundleFileName }}" /bv "${{ steps.get_package_info.outputs.version }}"
# Decode the base 64 encoded pfx and sign the package
- name: Sign .msixbundle
run: |
# Get signtool.exe
$signtool = Get-Item -Path "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe"
if ($signtool -is [array]) {
$signtool = $signtool[0]
}
# Sign .msixbundle
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.PFX_BASE64_ENCODED }}")
[IO.File]::WriteAllBytes("${{ env.SigningKey_Path }}", $pfx_cert_byte)
& $signtool sign /f "${{ env.SigningKey_Path }}" /fd SHA256 /td SHA256 "${{ steps.get_package_info.outputs.bundleFileName }}"
rm "${{ env.SigningKey_Path }}"
- name: Upload .msixbundle to artifacts
uses: actions/upload-artifact@v4
with:
name: .msixbundle
path: ${{ steps.get_package_info.outputs.bundleFileName }}
Create-Tag:
runs-on: ubuntu-latest
name: Create tag
needs: build
if: ${{inputs.flag}}
outputs:
tag: "refs/tags/${{inputs.tag1}}${{inputs.tag2}}"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Config git user
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub-actions[bot]"
- name: Create tag
run: |
git tag -a ${{inputs.tag1}}${{inputs.tag2}} -m "${{inputs.tag1}}${{inputs.tag2}}"
git push origin ${{inputs.tag1}}${{inputs.tag2}}
Pre-Publish:
runs-on: ubuntu-latest
name: Pre-Publish
needs: [build, release, Create-Tag]
if: ${{ (contains(github.ref,'refs/tags/beta')||(inputs.flag&&contains(needs.Create-Tag.outputs.tag,'beta'))||(inputs.flag&&contains(needs.Create-Tag.outputs.tag,'v')))&&!failure() }}
env:
Artifacts_Path: .artifacts
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check tag
id: CheckTag
run: |
if [ "${{inputs.flag}}" ]; then
echo "tag=${{needs.Create-Tag.outputs.tag}}" >> "$GITHUB_OUTPUT"
echo exit 0
else
echo "tag=${{github.ref}}" >> "$GITHUB_OUTPUT"
echo exit 0
fi
- name: Download .msixupload from artifacts
uses: actions/download-artifact@v4
with:
name: .msixupload
path: "${{ github.workspace }}/${{env.Artifacts_Path}}"
- name: Delete arm Pkg
run: find "${{ github.workspace }}/${{env.Artifacts_Path}}" -name '*arm*' -exec rm {} \;
- name: Pre-Publish MSStore
uses: trympet/microsoft-store-flight-action@v1
with:
tenant-id: ${{ secrets.PARTNER_CENTER_TENANT_ID }}
client-id: ${{ secrets.PARTNER_CENTER_CLIENT_ID }}
client-secret: ${{ secrets.PARTNER_CENTER_CLIENT_SECRET }}
app-id: ${{ secrets.PARTNER_CENTER_APP_ID }}
flight-id: ${{ secrets.PARTNER_CENTER_BETA_APP_ID }}
package-path: "${{ github.workspace }}/${{env.Artifacts_Path}}/"
delete-pending: true
delete-packages: true
skip-polling: true
packages-keep: 9
- name: Download .msixbundle from artifacts
if: ${{ !contains(needs.Create-Tag.outputs.tag,'v') }}
uses: actions/download-artifact@v4
with:
name: .msixbundle
path: "${{ github.workspace }}/${{env.Artifacts_Path}}"
- name: Create Pre-Release
if: ${{ !contains(needs.Create-Tag.outputs.tag,'v') }}
uses: ncipollo/[email protected]
with:
artifacts: "${{ github.workspace }}/${{env.Artifacts_Path}}/*.msixbundle"
prerelease: true
allowUpdates: true
generateReleaseNotes: true
tag: ${{steps.CheckTag.outputs.tag}}
Publish:
runs-on: ubuntu-latest
name: Publish
needs: [build, release, Create-Tag]
if: ${{ (contains(github.ref,'v2')||(inputs.flag&&contains(needs.Create-Tag.outputs.tag,'v2')))&&!failure() }}
env:
Artifacts_Path: .artifacts
steps:
- name: CheckOut
uses: actions/checkout@v3
- name: CheckTag
id: CheckTag
run: |
if [ "${{inputs.flag}}" ]; then
echo "tag=${{needs.Create-Tag.outputs.tag}}" >> "$GITHUB_OUTPUT"
echo exit 0
else
echo "tag=${{github.ref}}" >> "$GITHUB_OUTPUT"
echo exit 0
fi
- name: Download .msixupload from artifacts
uses: actions/download-artifact@v3
with:
name: .msixupload
path: "${{ github.workspace }}/${{env.Artifacts_Path}}"
- name: Delete arm Pkg
run: find "${{ github.workspace }}/${{env.Artifacts_Path}}" -name '*arm*' -exec rm {} \;
- name: Publish MSStore
uses: isaacrlevin/[email protected]
with:
tenant-id: ${{ secrets.PARTNER_CENTER_TENANT_ID }}
client-id: ${{ secrets.PARTNER_CENTER_CLIENT_ID }}
client-secret: ${{ secrets.PARTNER_CENTER_CLIENT_SECRET }}
app-id: ${{ secrets.PARTNER_CENTER_APP_ID }}
package-path: "${{ github.workspace }}/${{env.Artifacts_Path}}/"
delete-pending: true
delete-packages: true
skip-polling: true
packages-keep: 9
- name: Download .msixbundle from artifacts
uses: actions/download-artifact@v3
with:
name: .msixbundle
path: "${{ github.workspace }}/${{env.Artifacts_Path}}"
- name: Create Release
uses: ncipollo/[email protected]
with:
artifacts: "${{ github.workspace }}/${{env.Artifacts_Path}}/*.msixbundle"
allowUpdates: true
generateReleaseNotes: true
tag: ${{steps.CheckTag.outputs.tag}}