|
| 1 | +# Trigger on commits to master and tags v* |
| 2 | +trigger: |
| 3 | + branches: |
| 4 | + include: |
| 5 | + - dev |
| 6 | + - release |
| 7 | + - master |
| 8 | + tags: |
| 9 | + include: |
| 10 | + - v* |
| 11 | + |
| 12 | +pr: |
| 13 | + branches: |
| 14 | + include: |
| 15 | + - dev |
| 16 | + - release |
| 17 | + - master |
| 18 | + |
| 19 | +# Use the latest macOS hosted agent |
| 20 | +pool: |
| 21 | + vmImage: 'macos-latest' |
| 22 | + |
| 23 | +steps: |
| 24 | +# 1. Download and install Apple code-signing certificate (P12) |
| 25 | +- task: DownloadSecureFile@1 # download from Secure Files library :contentReference[oaicite:4]{index=4} |
| 26 | + name: appleCert |
| 27 | + inputs: |
| 28 | + secureFile: 'certificate.p12' # the name you gave when uploading the P12 |
| 29 | + |
| 30 | +- task: InstallAppleCertificate@2 # install into temp keychain :contentReference[oaicite:5]{index=5} |
| 31 | + inputs: |
| 32 | + certSecureFile: 'certificate.p12' |
| 33 | + certPwd: '$(CSC_KEY_PASSWORD)' # store your P12 password as a pipeline secret |
| 34 | + |
| 35 | +# 2. Install Node.js |
| 36 | +- task: NodeTool@0 # get Node.js on PATH :contentReference[oaicite:6]{index=6} |
| 37 | + inputs: |
| 38 | + versionSpec: '18.x' # match your local dev version |
| 39 | + |
| 40 | +# 3. Install dependencies and build |
| 41 | +- script: | |
| 42 | + npm ci # clean install dependencies |
| 43 | + npm run build # runs build-css & build-js as per your package.json |
| 44 | + displayName: 'npm install & build' |
| 45 | + |
| 46 | +# 4. Package macOS build with electron-builder |
| 47 | +- script: | |
| 48 | + npm run pack:macArm # runs electron-builder --mac --arm64 as per your scripts |
| 49 | + displayName: 'Package macOS (x64 & arm64)' |
| 50 | + env: |
| 51 | + CSC_KEYCHAIN: 'temp' # tell electron-builder which keychain to use |
| 52 | + CSC_IDENTITY_AUTO_DISCOVERY: 'false' # optional: skip delay in identity lookup |
| 53 | + # electron-builder picks up the cert from the temp keychain |
| 54 | + |
| 55 | +# 5. Publish the dmg and zip from the 'builds' folder |
| 56 | +- task: PublishPipelineArtifact@1 |
| 57 | + inputs: |
| 58 | + targetPath: 'builds' # matches "directories.output" in your build config |
| 59 | + artifact: 'macOS' |
| 60 | + publishLocation: 'pipeline' |
0 commit comments