Skip to content

Package Native Dependencies #4

Package Native Dependencies

Package Native Dependencies #4

name: Package Native Dependencies
permissions:
contents: read
on:
workflow_dispatch:
# Fires after publish-ci.yml completes. publish-next filters for scheduled
# next publishes; stable releases use workflow_dispatch instead.
# NOTE: Matched by name; renaming publish-ci.yml breaks this trigger.
workflow_run:
workflows: ["Publish packages to NPM"]
types: [completed]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Full matrix on dispatch (stable releases), linux-only on workflow_run (next).
# macos-15 = arm64, macos-15-intel = x64 (aligned with eclipse-theia/theia-ide).
os: ${{ fromJSON(github.event_name == 'workflow_dispatch' && '["ubuntu-22.04","windows-2022","macos-15","macos-15-intel"]' || '["ubuntu-22.04"]') }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# On workflow_run, check out the exact published commit.
ref: ${{ github.event.workflow_run.head_sha }}
# Update the node version here after every Electron upgrade
- name: Use Node.js v24.15.0
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: "24.15.0"
registry-url: "https://registry.npmjs.org"
- name: Use Python 3.13
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Install
shell: bash
run: |
npm ci
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9
- name: Build Browser App
shell: bash
run: |
npm run build:browser
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: Zip Native Dependencies
shell: bash
run: npm run zip:native:dependencies
- name: Upload Artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: native-dependencies-${{ matrix.os }}
path: ./scripts/native-dependencies-*.zip
retention-days: 7
# Publishes a rolling `next` pre-release after a successful scheduled npm
# next publish on master. Stable releases skip this; the maintainer attaches
# artifacts to the vX.Y.Z release manually.
publish-next:
name: Publish to rolling `next` pre-release
needs: build
if: >-
${{ github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'schedule' &&
github.event.workflow_run.head_branch == 'master' }}
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Download native-dependencies artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: native-dependencies-*
merge-multiple: true
path: ./native-deps
- name: Publish rolling `next` release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PUBLISHED_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
gh release delete next --yes --cleanup-tag 2>/dev/null || true
gh release create next \
--title "Native Dependencies - Next ($(date -u '+%Y-%m-%d'))" \
--notes "Automated next build of native dependencies from \`master\` (commit \`${PUBLISHED_SHA}\`, $(date -u '+%Y-%m-%d %H:%M UTC'))." \
--prerelease \
--target "${PUBLISHED_SHA}" \
./native-deps/native-dependencies-*.zip