aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/build_macos.yml
blob: 33f0cc510b2d13808032b0b5ddf3f29da7b77f31 (about) (plain) (blame)
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
name: Build macOS

on:
  push:
    branches:
      - master
    paths-ignore:
      - '**.md'
    tags:
      - '*'
  pull_request:
    paths-ignore:
      - '**.md'

jobs:
  build-macos:
    runs-on: macos-14
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: ccache
        uses: hendrikmuhs/ccache-action@v1.2
        with:
          key: build-macos-release

      - name: Install Qt
        uses: jurplel/install-qt-action@v4
        with:
          version: 6.10.0
          modules: qt5compat qtmultimedia

      - name: Install other prerequisites
        run: |
          brew update
          brew install enchant openssl create-dmg --force-bottle || true

      - name: Configure CMake
        run: |
          cd '${{github.workspace}}'
          mkdir build
          cd build
          cmake \
            -DCMAKE_BUILD_TYPE=Release \
            -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
            -DWANT_PYTHON=OFF \
            ..

      - name: Build
        run: |
          cd '${{github.workspace}}'
          cd build
          cmake --build .

      - name: Install
        run: |
          cd '${{github.workspace}}'
          cd build
          cmake --install .

      - name: Deployt Qt
        run: |
          cd '${{github.workspace}}'
          macdeployqt "build/KVIrc.app" -appstore-compliant

      - name: Detect version
        shell: bash
        run: |
          cd '${{github.workspace}}'
          kvi_version=$(grep -i "^set(VERSION_RELEASE .*)$" CMakeLists.txt | egrep -o '[0-9\.]' | tr -d '\n')
          git_desc=$(git describe --always)
          echo "dmg_name=KVIrc-$kvi_version-dev-$(date +%F)-git-$git_desc" >> "$GITHUB_ENV"

      - name: Create DMG
        shell: bash
        run: |
          # BUG: https://github.com/actions/runner-images/issues/7522
          cd '${{github.workspace}}'
          for i in {1..10};
          do
            if create-dmg --volname "${{ env.dmg_name }}" \
              --background "dist/macos/installer_background.png" \
              --window-pos 200 120 \
              --window-size 800 450 \
              --icon KVIrc.app 200 190 \
              --icon-size 100 \
              --app-drop-link 600 185 "${{ env.dmg_name }}.dmg" "build/KVIrc.app";
            then
              echo "DMG created"
              break
            else
              echo "create-dmg failed $i"
            fi
          done

      - name: Publish artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ env.dmg_name }}.dmg
          path: ${{ env.dmg_name }}.dmg