forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (133 loc) · 4.89 KB
/
build-mudlet-win.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
name: 🔨 Build Mudlet (windows)
on:
push:
branches: [master, development, release-*]
tags: [Mudlet-*]
pull_request:
workflow_dispatch:
inputs:
scheduled:
description: 'Imitate a scheduled build'
required: false
default: 'false'
schedule:
- cron: '0 2 * * *'
jobs:
compile-mudlet:
name: ${{matrix.buildname}}
runs-on: ${{matrix.os}}
if: ${{ github.repository_owner == 'Mudlet' }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
buildname: 'windows64'
- os: windows-2019
buildname: 'windows32'
steps:
- name: Checkout Mudlet source code
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: (Windows 64) Setup MSYS2
if: matrix.buildname == 'windows64'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
- name: (Windows 32) Setup MSYS2
if: matrix.buildname == 'windows32'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
update: true
- name: (Windows) Build Environment Setup
shell: msys2 {0}
env:
GITHUB_REPO_TAG: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
run: |
$GITHUB_WORKSPACE/CI/setup-windows-sdk.sh
$GITHUB_WORKSPACE/CI/validate-deployment-for-windows.sh
- name: restore ccache
uses: actions/cache@v4
with:
path: ${{runner.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.buildname}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.buildname}}
save-always: true
- name: (Windows) Build
shell: msys2 {0}
env:
GITHUB_REPO_TAG: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
GITHUB_SCHEDULED_BUILD: ${{ github.event_name == 'schedule' || github.event.inputs.scheduled == 'true' }}
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: $GITHUB_WORKSPACE/CI/build-mudlet-for-windows.sh
- name: (Windows) Package
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/package-mudlet-for-windows.sh
- name: (Windows) Login to Azure
uses: azure/login@v2
if: github.repository == 'Mudlet/Mudlet'
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Get Azure access token for code signing
shell: pwsh
if: github.repository == 'Mudlet/Mudlet'
run: |
$token = (az account get-access-token --resource https://codesigning.azure.net | ConvertFrom-Json).accessToken
"::add-mask::$token"
"AZURE_ACCESS_TOKEN=$token" | Add-Content -Path $env:GITHUB_ENV
- name: (Windows) Deploy
shell: msys2 {0}
env:
DBLSQD_USER: ${{secrets.DBLSQD_USER}}
DBLSQD_PASS: ${{secrets.DBLSQD_PASS}}
DEPLOY_KEY_PASS: ${{secrets.DEPLOY_KEY_PASS}}
DEPLOY_SSH_KEY: ${{secrets.DEPLOY_SSH_KEY}}
DEPLOY_PATH: ${{secrets.DEPLOY_PATH}}
AZURE_ACCESS_TOKEN: ${{ env.AZURE_ACCESS_TOKEN }}
GITHUB_REPO_NAME: ${{ github.repository }}
GITHUB_REPO_TAG: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
GITHUB_SCHEDULED_BUILD: ${{ github.event_name == 'schedule' || github.event.inputs.scheduled == 'true' }}
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: $GITHUB_WORKSPACE/CI/deploy-mudlet-for-windows.sh
- name: Upload packaged Mudlet
uses: actions/upload-artifact@v4
if: env.UPLOAD_FILENAME
with:
name: ${{env.UPLOAD_FILENAME}}
path: ${{env.FOLDER_TO_UPLOAD}}
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Submit to make.mudlet.org
if: env.UPLOAD_FILENAME
run: |
$uri = "https://make.mudlet.org/snapshots/gha_queue.php?artifact_name=$($env:UPLOAD_FILENAME)&unzip=$($env:PARAM_UNZIP)"
try {
$response = Invoke-WebRequest -Uri $uri -Method Post -ErrorAction Stop
Write-Output "Submission successful"
}
catch {
$errorMessage = $_.Exception.Message
if ($errorMessage -like "*Artifact is not unique*") {
Write-Output "Info: Artifact was already submitted and is not unique. Continuing..."
exit 0
}
else {
Write-Error "An error occurred: $errorMessage"
exit 1
}
}
shell: pwsh
- name: Register Release
shell: msys2 {0}
if: env.PUBLIC_TEST_BUILD == 'true'
env:
ARCH: ${{env.ARCH}}
VERSION_STRING: ${{env.VERSION_STRING}}
BUILD_COMMIT: ${{env.BUILD_COMMIT}}
run: $GITHUB_WORKSPACE/CI/register-windows-release.sh