build sea for windows macos and linux #62
Workflow file for this run
This file contains 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: | |
pull_request: | |
branches: ['main'] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/composite/build | |
build-seas: | |
needs: build | |
name: ${{ matrix.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: set the executable name | |
id: set-executable-name | |
uses: actions/github-script@v7 | |
env: | |
MATRIX_OS: ${{ matrix.os }} | |
with: | |
script: | | |
const os = process.env.MATRIX_OS; | |
let executableName = 'hdcli'; | |
if (os === 'windows-latest') { | |
executableName = 'hdcli.exe'; | |
} | |
return executableName; | |
result-encoding: string | |
- name: restore the sea blob from cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./dist/apps/cli/sea-prep.blob | |
key: hdcli-sea-blob-${{ github.run_id }} | |
- name: copy node to use to create sea | |
if: matrix.os != 'windows-latest' | |
run: cp $(command -v node) hdcli | |
working-directory: ./dist/apps/cli | |
shell: bash | |
- name: copy node to use to create sea | |
if: matrix.os == 'windows-latest' | |
run: node -e "require('fs').copyFileSync(process.execPath, 'hdcli.exe')" | |
working-directory: \dist\apps\cli | |
shell: pwsh | |
- name: remove the signature of the binary | |
if: matrix.os == 'macos-latest' | |
run: codesign --remove-signature hdcli | |
working-directory: ./dist/apps/cli | |
shell: bash | |
- name: inject the CLI sea into the copied node | |
if: matrix.os == 'ubuntu-latest' | |
run: npx postject ${{ steps.set-executable-name.outputs.result }} NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | |
working-directory: ./dist/apps/cli | |
shell: bash | |
- name: inject the CLI sea into the copied node | |
if: matrix.os == 'windows-latest' | |
run: npx postject ${{ steps.set-executable-name.outputs.result }} NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | |
working-directory: \dist\apps\cli | |
shell: pwsh | |
- name: inject the CLI sea into the copied node | |
if: matrix.os == 'macos-latest' | |
run: npx postject ${{ steps.set-executable-name.outputs.result }} NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA | |
working-directory: ./dist/apps/cli | |
shell: bash | |
- name: sign the binary | |
if: matrix.os == 'macos-latest' | |
run: codesign --sign - ${{ steps.set-executable-name.outputs.result }} | |
working-directory: ./dist/apps/cli | |
shell: bash | |
# would require a certificate to sign the binary on windows | |
# - name: sign the binary | |
# if: matrix.os == 'windows-latest' | |
# run: signtool sign /fd SHA256 ${{ steps.set-executable-name.outputs.result }} | |
# working-directory: \dist\apps\cli | |
# shell: pwsh | |
- name: cache the sea binary | |
uses: actions/cache/save@v4 | |
with: | |
path: ./dist/apps/cli/${{ steps.set-executable-name.outputs.result }} | |
key: hdcli-sea-${{ matrix.os }}-${{ github.run_id }} | |
verify: | |
needs: build-seas | |
uses: ./.github/workflows/runtime-tests.yml |