Skip to content

Commit 12360ee

Browse files
committed
Add PR builds for mac app.
1 parent e07e8dd commit 12360ee

File tree

2 files changed

+68
-8
lines changed

2 files changed

+68
-8
lines changed

.github/workflows/build_mac.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ on:
1515
workflow_call:
1616
inputs:
1717
whl-file-name:
18-
required: true
18+
required: false
19+
type: string
20+
whl-url:
21+
required: false
1922
type: string
2023
ref:
2124
description: 'A ref for this workflow to check out its own repo'
22-
required: true
25+
required: false
2326
type: string
2427
release:
2528
description: 'Is this a release asset?'
@@ -55,6 +58,11 @@ jobs:
5558
PYTHON_VERSION: "3.10.10"
5659
MACOSX_DEPLOYMENT_TARGET: "10.9"
5760
steps:
61+
- name: Validate whl reference inputs
62+
if: ${{ (inputs.whl-file-name && inputs.whl-url) || (!inputs.whl-file-name && !inputs.whl-url) }}
63+
run: |
64+
echo "Must specify exactly one reference for the whl file to build the EXE with."
65+
exit 1
5866
- uses: actions/checkout@v4
5967
if: ${{ !inputs.ref }}
6068
- uses: actions/checkout@v4
@@ -85,8 +93,8 @@ jobs:
8593
- name: Install dependencies
8694
run: make dependencies
8795
- name: Download the whlfile from URL and install
88-
if: ${{ github.event.inputs.whl-url }}
89-
run: make get-whl whl=${{ github.event.inputs.whl-url }}
96+
if: ${{ inputs.whl-url }}
97+
run: make get-whl whl=${{ inputs.whl-url }}
9098
- name: Download the whlfile from artifacts
9199
if: ${{ inputs.whl-file-name }}
92100
uses: actions/download-artifact@v4
@@ -97,7 +105,7 @@ jobs:
97105
if: ${{ inputs.whl-file-name }}
98106
run: make install-whl whl=whl/${{ inputs.whl-file-name }}
99107
- name: Setup app signing certificate
100-
if: ${{ inputs.release == true || github.event.inputs.release == 'true' }}
108+
if: ${{ inputs.release }}
101109
env:
102110
KEYCHAIN_PASSWORD: ${{ hashFiles('*')}}
103111
run: |
@@ -114,15 +122,15 @@ jobs:
114122
- name: Build the app
115123
run: make build-mac-app
116124
- name: Codesign the app
117-
if: ${{ inputs.release == true || github.event.inputs.release == 'true' }}
125+
if: ${{ inputs.release }}
118126
run: MAC_CODESIGN_IDENTITY="${{ secrets.KOLIBRI_MAC_APP_IDENTITY }}" make codesign-mac-app
119127
- name: Build the DMG
120128
run: make build-dmg
121129
- name: Codesign the DMG
122-
if: ${{ inputs.release == true || github.event.inputs.release == 'true' }}
130+
if: ${{ inputs.release }}
123131
run: MAC_CODESIGN_IDENTITY="${{ secrets.KOLIBRI_MAC_APP_IDENTITY }}" make codesign-dmg
124132
- name: Notarize the DMG
125-
if: ${{ inputs.release == true || github.event.inputs.release == 'true' }}
133+
if: ${{ inputs.release }}
126134
env:
127135
MAC_NOTARIZE_USERNAME: ${{ secrets.KOLIBRI_MAC_APP_USERNAME }}
128136
MAC_NOTARIZE_PASSWORD: ${{ secrets.KOLIBRI_MAC_APP_PASSWORD }}

.github/workflows/pr_build.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build DMG for PRs
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
pre_job:
10+
name: Path match check
11+
runs-on: ubuntu-latest
12+
# Map a step output to a job output
13+
outputs:
14+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
15+
steps:
16+
- id: skip_check
17+
uses: fkirc/skip-duplicate-actions@master
18+
with:
19+
github_token: ${{ github.token }}
20+
latest_kolibri_release:
21+
needs: pre_job
22+
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
23+
runs-on: ubuntu-latest
24+
outputs:
25+
whl-url: ${{ steps.get_latest_kolibri_release.outputs.result }}
26+
steps:
27+
- name: Get latest Kolibri release
28+
id: get_latest_kolibri_release
29+
uses: actions/github-script@v7
30+
with:
31+
result-encoding: string
32+
script: |
33+
34+
const { data: releases } = await github.rest.repos.listReleases({
35+
owner: 'learningequality',
36+
repo: 'kolibri',
37+
per_page: 1,
38+
page: 1,
39+
});
40+
41+
const latestRelease = releases[0];
42+
const whlAsset = latestRelease.assets.find(asset => asset.name.endsWith('.whl'));
43+
const whlUrl = whlAsset.browser_download_url;
44+
return whlUrl;
45+
46+
build_dmg:
47+
name: Build Unsigned DMG
48+
needs: [pre_job, latest_kolibri_release]
49+
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
50+
uses: ./.github/workflows/build_mac.yml
51+
with:
52+
whl-url: ${{ needs.latest_kolibri_release.outputs.whl-url }}

0 commit comments

Comments
 (0)