fix: publish session-host-core for daemon upgrades #150
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| permissions: | |
| actions: read | |
| contents: read | |
| concurrency: | |
| group: ci-oss-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22] | |
| env: | |
| ADHDEV_SKIP_GHOSTTY_VT_BUILD: '1' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Compute ghostty triplet | |
| run: echo "GHOSTTY_TRIPLET=linux-x64-node$(node -p 'process.versions.modules')" >> "$GITHUB_ENV" | |
| - name: Download latest ghostty prebuilt artifact | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| mkdir -p "packages/ghostty-vt-node/prebuilt/${GHOSTTY_TRIPLET}" | |
| run_id="$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/ghostty-vt-node.yml/runs?branch=main&event=push&per_page=20" --jq '.workflow_runs[] | select(.conclusion == "success") | .id' | head -n 1 || true)" | |
| if [ -z "${run_id}" ]; then | |
| echo "No successful Ghostty VT Native run found on main; continuing without prebuilt artifact." | |
| exit 0 | |
| fi | |
| gh run download "${run_id}" \ | |
| --repo "${GITHUB_REPOSITORY}" \ | |
| --name "ghostty-vt-node-${GHOSTTY_TRIPLET}" \ | |
| --dir "packages/ghostty-vt-node/prebuilt/${GHOSTTY_TRIPLET}" || { | |
| echo "Ghostty prebuilt artifact download failed; continuing without it." | |
| exit 0 | |
| } | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build all packages | |
| run: npm run build | |
| - name: Verify shebang | |
| run: head -1 packages/daemon-standalone/dist/index.js | grep '#!/usr/bin/env node' | |
| - name: Upload publish artifacts | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: publish-artifacts | |
| path: | | |
| packages/session-host-core/dist | |
| packages/session-host-daemon/dist | |
| packages/daemon-core/dist | |
| packages/daemon-standalone/dist | |
| packages/web-standalone/dist | |
| if-no-files-found: error | |
| publish: | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| env: | |
| ADHDEV_SKIP_GHOSTTY_VT_BUILD: '1' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js 22 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download publish artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: publish-artifacts | |
| path: packages | |
| - name: Bundle web into daemon-standalone | |
| run: npm run bundle:web -w packages/daemon-standalone | |
| - name: Bundle vendored runtime deps into daemon-standalone | |
| run: npm run bundle:vendor -w packages/daemon-standalone | |
| - name: Publish @adhdev/session-host-core | |
| if: env.NODE_AUTH_TOKEN != '' | |
| run: cd packages/session-host-core && npm publish --access public --ignore-scripts || echo '⚠️ session-host-core publish skipped (version may already exist)' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish @adhdev/daemon-core | |
| if: env.NODE_AUTH_TOKEN != '' | |
| run: cd packages/daemon-core && npm publish --access public --ignore-scripts || echo '⚠️ daemon-core publish skipped (version may already exist)' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish @adhdev/daemon-standalone | |
| if: env.NODE_AUTH_TOKEN != '' | |
| run: cd packages/daemon-standalone && npm publish --access public --ignore-scripts || echo '⚠️ daemon-standalone publish skipped (version may already exist)' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |