Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build Packages

on:
workflow_dispatch:
inputs:
channel:
type: choice
default: dev
options:
- dev
- stage
- production
upgrade-key:
type: string
description: Value for package.json upgrade field
default: ''
required: false
run-linux-arm:
type: boolean
default: true
run-macos:
type: boolean
default: true
run-macos-intel:
type: boolean
default: false
run-windows:
type: boolean
default: true
run-stage:
type: boolean
default: false
stage-dry-run:
type: boolean
default: true
stage-namespace:
type: string
default: ''
notify:
type: boolean
default: true

permissions:
contents: write
packages: read
actions: write
pull-requests: write

jobs:
build:
uses: holepunchto/pear-ci-build/.github/workflows/build.yml@main
secrets: inherit
with:
ref: ${{ github.sha }}
channel: ${{ inputs.channel }}
upgrade-key: ${{ inputs.upgrade-key }}
run-linux-arm: ${{ inputs.run-linux-arm }}
run-macos: ${{ inputs.run-macos }}
run-macos-intel: ${{ inputs.run-macos-intel }}
run-windows: ${{ inputs.run-windows }}
run-stage: ${{ inputs.run-stage }}
stage-dry-run: ${{ inputs.stage-dry-run }}
stage-namespace: ${{ inputs.stage-namespace }}
notify: ${{ inputs.notify }}
1 change: 1 addition & 0 deletions ci/snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "bare scripts/test.mjs",
"format": "prettier --write . && lunte --fix",
"lint": "prettier --check . && lunte",
"make": "bare scripts/make.js production",
"make": "bare scripts/make.js",
"make:stage": "bare scripts/make.js stage",
"make:dev": "bare scripts/make.js dev",
"hyperdb:build": "node scripts/build-hyperdb.js"
Expand Down
24 changes: 20 additions & 4 deletions scripts/make.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const fs = require('bare-fs')
const path = require('bare-path')
const env = require('bare-env')
const { spawn } = require('bare-subprocess')
const { platform, arch } = require('which-runtime')
const { platform, arch, isWindows } = require('which-runtime')

const channel = global.Bare.argv[2]
const channel = global.Bare.argv[2] || env.CHANNEL || 'production'
const host = `${platform}-${arch}`
const bin = isWindows ? 'pear.exe' : 'pear'
const out = path.join('.', 'by-arch', host, 'bin')

const child = spawn(
'bare-build',
Expand All @@ -17,12 +22,23 @@ const child = spawn(
'--host',
host,
'--out',
`./by-arch/${host}/bin`,
out,
`targets/main.${channel}.js`
],
{ stdio: 'inherit', shell: true }
)

child.on('exit', (code, signal) => {
Bare.exitCode = signal ? 128 + signal : code
if (signal) return Bare.exit(128 + signal)
if (code !== 0) return Bare.exit(code)

const src = path.join(out, bin)
const ext = isWindows ? '.exe' : ''
const dest = path.join('out', 'make', `pear-${host}${ext}`)

fs.mkdirSync(path.dirname(dest), { recursive: true })
fs.copyFileSync(src, dest)
fs.chmodSync(dest, 0o755)

console.log(`wrote ${dest}`)
})
Loading