2023-07-07 11:11:29 +02:00
|
|
|
name: Build macOS M1
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
2023-07-11 10:58:05 +02:00
|
|
|
pre_job:
|
|
|
|
if: github.repository == 'laurent22/joplin'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
|
|
|
steps:
|
|
|
|
- id: skip_check
|
|
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
|
|
with:
|
|
|
|
concurrent_skipping: 'same_content_newer'
|
2023-07-07 11:11:29 +02:00
|
|
|
|
2023-07-11 10:58:05 +02:00
|
|
|
Main:
|
|
|
|
needs: pre_job
|
2023-07-13 14:08:43 +02:00
|
|
|
# We always process desktop release tags, because they also publish the release
|
|
|
|
if: github.repository == 'laurent22/joplin' && (needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/v'))
|
|
|
|
runs-on: macos-latest
|
2023-07-11 10:58:05 +02:00
|
|
|
steps:
|
2023-07-07 11:11:29 +02:00
|
|
|
|
2024-01-08 13:53:46 +02:00
|
|
|
- uses: actions/checkout@v4
|
2024-04-07 15:42:50 +02:00
|
|
|
- uses: olegtarasov/get-tag@v2.1.3
|
|
|
|
- uses: actions/setup-node@v4
|
2023-07-11 10:58:05 +02:00
|
|
|
with:
|
|
|
|
# We need to pin the version to 18.15, because 18.16+ fails with this error:
|
|
|
|
# https://github.com/facebook/react-native/issues/36440
|
|
|
|
node-version: '18.15.0'
|
2023-08-05 17:57:17 +02:00
|
|
|
cache: 'yarn'
|
2023-07-07 11:11:29 +02:00
|
|
|
|
2023-07-11 10:58:05 +02:00
|
|
|
- name: Install Yarn
|
|
|
|
run: |
|
|
|
|
# https://yarnpkg.com/getting-started/install
|
|
|
|
corepack enable
|
2023-07-07 11:11:29 +02:00
|
|
|
|
2023-12-13 21:24:58 +02:00
|
|
|
- name: Install macOs dependencies
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
|
|
|
# Required for building the canvas package
|
|
|
|
brew install pango
|
|
|
|
|
2023-11-05 15:33:38 +02:00
|
|
|
# See github-action-main.yml for explanation
|
2024-04-07 15:42:50 +02:00
|
|
|
- uses: actions/setup-python@v5
|
2023-11-05 15:33:38 +02:00
|
|
|
with:
|
|
|
|
python-version: '3.11'
|
|
|
|
|
2024-09-04 13:11:17 +02:00
|
|
|
- name: Set Publish Flag
|
|
|
|
run: |
|
|
|
|
if [[ $GIT_TAG_NAME = v* ]]; then
|
|
|
|
echo "PUBLISH_ENABLED=true" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo "PUBLISH_ENABLED=false" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
|
2023-07-11 10:58:05 +02:00
|
|
|
- name: Build macOS M1 app
|
|
|
|
env:
|
|
|
|
APPLE_ASC_PROVIDER: ${{ secrets.APPLE_ASC_PROVIDER }}
|
|
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
|
|
|
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CSC_KEY_PASSWORD }}
|
|
|
|
CSC_LINK: ${{ secrets.APPLE_CSC_LINK }}
|
2023-08-27 12:26:03 +02:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
GH_REPO: ${{ github.repository }}
|
2023-07-11 10:58:05 +02:00
|
|
|
IS_CONTINUOUS_INTEGRATION: 1
|
|
|
|
BUILD_SEQUENCIAL: 1
|
2024-09-04 13:11:17 +02:00
|
|
|
PUBLISH_ENABLED: ${{ env.PUBLISH_ENABLED }}
|
2023-07-11 10:58:05 +02:00
|
|
|
run: |
|
|
|
|
export npm_config_arch=arm64
|
|
|
|
export npm_config_target_arch=arm64
|
|
|
|
yarn install
|
|
|
|
cd packages/app-desktop
|
|
|
|
npm pkg set 'build.mac.artifactName'='${productName}-${version}-${arch}.${ext}'
|
2024-08-15 16:59:18 +02:00
|
|
|
npm pkg set 'build.mac.target[0].target'='dmg'
|
|
|
|
npm pkg set 'build.mac.target[0].arch[0]'='arm64'
|
|
|
|
npm pkg set 'build.mac.target[1].target'='zip'
|
|
|
|
npm pkg set 'build.mac.target[1].arch[0]'='arm64'
|
2023-07-09 12:20:21 +02:00
|
|
|
|
2024-09-04 13:11:17 +02:00
|
|
|
if [[ "$PUBLISH_ENABLED" == "true" ]]; then
|
2023-07-11 10:58:05 +02:00
|
|
|
echo "Building and publishing desktop application..."
|
2024-01-26 22:19:28 +02:00
|
|
|
PYTHON_PATH=$(which python) USE_HARD_LINKS=false yarn dist --mac --arm64
|
2023-08-27 12:26:03 +02:00
|
|
|
|
2024-09-14 23:16:42 +02:00
|
|
|
yarn modifyReleaseAssets --repo="$GH_REPO" --tag="$GIT_TAG_NAME" --token="$GITHUB_TOKEN"
|
2023-07-11 10:58:05 +02:00
|
|
|
else
|
|
|
|
echo "Building but *not* publishing desktop application..."
|
2023-07-12 16:44:14 +02:00
|
|
|
|
|
|
|
# We also want to disable signing the app in this case, because
|
|
|
|
# it doesn't work and we don't need it.
|
|
|
|
# https://www.electron.build/code-signing#how-to-disable-code-signing-during-the-build-process-on-macos
|
|
|
|
|
|
|
|
export CSC_IDENTITY_AUTO_DISCOVERY=false
|
2023-07-12 17:57:18 +02:00
|
|
|
npm pkg set 'build.mac.identity'=null --json
|
|
|
|
|
2024-01-26 22:19:28 +02:00
|
|
|
PYTHON_PATH=$(which python) USE_HARD_LINKS=false yarn dist --mac --arm64 --publish=never
|
2024-08-31 16:42:07 +02:00
|
|
|
fi
|