-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (117 loc) · 3.99 KB
/
MacOS.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
name: MacOS
on:
push:
paths-ignore:
# - '**'
- 'README.md'
pull_request:
paths-ignore:
- 'README.md'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-10.15] # macos-10.14 macos-10.15, macos-11.0, macos-12.6 # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
qt_ver: [5.15.2] # 参考: https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/mac_x64/desktop/qt5_5111
qt_arch: [clang_64]
env:
targetName: Flipped
targetLowerName: flipped
targetOS: macos
steps:
# macos 11.0 后默认环境变了,要指定
- name: prepare env
if: ${{ matrix.os >= 'macos-11.0' }}
run: |
softwareupdate --all --install --force
sudo xcode-select --print-path
sudo xcode-select --switch /Library/Developer/CommandLineTools
# - name: Cache Qt # 使用缓存安装Qt模块
# id: cache-qt
# uses: actions/cache@v1 # not v2! 参见 https://github.com/jurplel/install-qt-action
# with:
# path: ../Qt
# key: ${{ runner.os }}-QtCache
- name: Install Qt
# if: steps.cache-qt.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
# cached: ${{ steps.cache-qt.outputs.cache-hit }}
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: pull 3rdparty code
run: |
git submodule init
git submodule update
- name: build macos
run: |
mkdir build
cd build
cmake ..
make
echo "-------------- debug 1 --------------"
pwd
ls -al
echo "-------------- debug 1 --------------"
cd bin
ls -al
- name: NameVersion
id: NameVersion
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
run: |
$systemInfo="${{ env.targetOS }}"
$productVersion="${{ github.ref }}".substring("refs/tags/v".length)
$productName="${{ env.targetName }}_$productVersion_beta_$systemInfo"
echo "systemInfo=$systemInfo" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productVersion=$productVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productName=$productName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# tag打为.zip包
- name: package
id: package
if: startsWith(github.event.ref, 'refs/tags/')
shell: bash
run: |
# 拷贝依赖
mkdir bin
echo "-------------- debug 1 --------------"
pwd
ls -al
cp -r build/bin/${{ env.targetName }}.app bin
echo "-------------- debug 2 --------------"
pwd
ls -al
echo "-------------- debug 3 --------------"
cd bin
pwd
ls -al
macdeployqt ${{ env.targetName }}.app -dmg
mv ${{ env.targetName }}.dmg ../${{ env.productName }}.dmg
echo "-------------- debug 4 --------------"
pwd
ls -al
echo "-------------- debug 5 --------------"
cd ../
pwd
ls -al
echo "-------------- debug 6 --------------"
cd bin
ls -al
pwd
# tag上传Release
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.upload_release }}
with:
draft: false
prerelease: false
files: |
${{ env.productName }}.dmg
tag: ${{ github.ref }}
overwrite: true