From 76545e3c2372aadd458040e68483254c005ec8c0 Mon Sep 17 00:00:00 2001 From: XMuli Date: Thu, 20 Oct 2022 19:30:25 +0800 Subject: [PATCH] build: Compatible with mac 10.15 --- .DS_Store | Bin 10244 -> 10244 bytes .github/.DS_Store | Bin 6148 -> 6148 bytes .github/workflows/MacOS10.15.yml | 132 +++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 .github/workflows/MacOS10.15.yml diff --git a/.DS_Store b/.DS_Store index 6936172b4fd62f046a81ddf38aa587e4a41da09c..4dac54528547b12be9fcc6f44b87fc2651d2aae2 100644 GIT binary patch delta 138 zcmZn(XbG6$&nUeyU^hRb^kg0Z^~pBE4eZ872098xW|I#KJ4{v)kd|g=&|^qv$YdyC z$Y3aCNGc01%FD^mOJ`tUVBBmYpvPz|$dJsC%aF*B&5+8V%a89Q3T}20lw#bxKq#GeV}TjtW_E>NESt^6 Gn3(~D1P-47 diff --git a/.github/.DS_Store b/.github/.DS_Store index 36b372c72cba58418798b30534145e40b446efdb..cd99c0731e9e44138900472d2fbd82a415466670 100644 GIT binary patch delta 227 zcmZoMXfc=|#>B`mu~2NHo+2ab!~pAw2O5BMk5WA+Lpeh}LlHwZLmER4kX6o5oRe-C zoSdIqzyJmod_W3|s@!}Rm!zEhB%mxuG{Q>84b)dd;IRwr!SXv?;l jor9kP==hBrzcWwf7t!Sbxrz~p8-RGTkH`+@i480OC$Bdn delta 82 zcmZoMXfc=|#>CJzu~2NHo+2aT!~knX#>s(xkDAt diff --git a/.github/workflows/MacOS10.15.yml b/.github/workflows/MacOS10.15.yml new file mode 100644 index 0000000..b0e358c --- /dev/null +++ b/.github/workflows/MacOS10.15.yml @@ -0,0 +1,132 @@ +name: MacOS10.15 +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/virtual-environments/blob/main/images/macos/macos-11-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: PicShot + targetLowerName: picshot + 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: 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 }}-10.15" + $productVersion="${{ github.ref }}".substring("refs/tags/v".length) + $productName="${{ env.targetLowerName }}-$productVersion-beta-$systemInfo-x64" + + 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 \ No newline at end of file