Skip to content

Commit eb03f20

Browse files
authored
Added service process release process (#197)
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
1 parent 77df349 commit eb03f20

5 files changed

Lines changed: 151 additions & 9 deletions

File tree

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Release service-process binaries
2+
3+
on:
4+
push:
5+
tags:
6+
- service-process-v*
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build-binaries:
14+
name: Build (${{ matrix.os }})
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 22.14.0
29+
cache: npm
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Build service-process executable
35+
run: npm run create:executable --workspace=open-collaboration-service-process
36+
37+
- name: Prepare release artifact metadata
38+
id: meta
39+
shell: bash
40+
run: |
41+
TAG="${GITHUB_REF_NAME}"
42+
VERSION="${TAG#service-process-v}"
43+
44+
case "${{ runner.os }}" in
45+
Linux)
46+
OS_NAME="linux"
47+
EXT=""
48+
;;
49+
Windows)
50+
OS_NAME="windows"
51+
EXT=".exe"
52+
;;
53+
macOS)
54+
OS_NAME="macos"
55+
EXT=""
56+
;;
57+
*)
58+
echo "Unsupported OS: ${{ runner.os }}"
59+
exit 1
60+
;;
61+
esac
62+
63+
SOURCE="packages/open-collaboration-service-process/bin/oct-service-process${EXT}"
64+
TARGET="oct-service-process-${VERSION}-${OS_NAME}-x64${EXT}"
65+
66+
if [ ! -f "$SOURCE" ]; then
67+
echo "Expected binary not found: $SOURCE"
68+
exit 1
69+
fi
70+
71+
cp "$SOURCE" "$TARGET"
72+
echo "asset_name=$TARGET" >> "$GITHUB_OUTPUT"
73+
74+
- name: Upload binary artifact
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: ${{ steps.meta.outputs.asset_name }}
78+
path: ${{ steps.meta.outputs.asset_name }}
79+
if-no-files-found: error
80+
81+
create-release:
82+
name: Create GitHub release
83+
runs-on: ubuntu-latest
84+
needs: build-binaries
85+
86+
steps:
87+
- name: Download built binaries
88+
uses: actions/download-artifact@v4
89+
with:
90+
path: release-assets
91+
92+
- name: Flatten artifact directories
93+
shell: bash
94+
run: |
95+
mkdir -p dist
96+
find release-assets -type f -exec cp {} dist/ \;
97+
98+
- name: Generate checksums
99+
shell: bash
100+
run: |
101+
cd dist
102+
sha256sum * > SHA256SUMS.txt
103+
104+
- name: Publish GitHub release
105+
uses: softprops/action-gh-release@v2
106+
with:
107+
files: |
108+
dist/*
109+
generate_release_notes: true

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/open-collaboration-service-process/Readme.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,36 @@ Or sending Binary Data as a Parameter:
7474
]
7575
}
7676
```
77+
78+
## Release
79+
80+
Service process binaries are released through GitHub Actions.
81+
82+
### Automated binary release
83+
84+
The workflow `.github/workflows/release-service-process.yml` creates binaries for Linux, macOS, and Windows and publishes them to a GitHub Release.
85+
86+
Trigger a release by pushing a tag in this format: `service-process-v0.3.1`
87+
88+
The workflow publishes:
89+
90+
- `oct-service-process-<version>-linux-x64`
91+
- `oct-service-process-<version>-macos-x64`
92+
- `oct-service-process-<version>-windows-x64.exe`
93+
- `SHA256SUMS.txt`
94+
95+
You can also run the workflow manually with `workflow_dispatch` from the Actions tab.
96+
97+
### Build locally from source
98+
99+
If you need to build the executable without downloading a release artifact:
100+
101+
```sh
102+
npm ci
103+
npm run create:executable --workspace=open-collaboration-service-process
104+
```
105+
106+
The executable is written to:
107+
108+
- `packages/open-collaboration-service-process/bin/oct-service-process` on Linux and macOS
109+
- `packages/open-collaboration-service-process/bin/oct-service-process.exe` on Windows

packages/open-collaboration-service-process/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
"license": "MIT",
55
"description": "A service process for integrating non Typescript projects with the Open Collaboration Tools project",
66
"files": [
7-
"bin",
8-
"lib",
9-
"src"
7+
"lib/bundle.cjs"
108
],
119
"type": "module",
1210
"main": "./lib/messages.js",
@@ -25,12 +23,13 @@
2523
}
2624
},
2725
"bin": {
28-
"oct-daemon-service": "./bin/service"
26+
"oct-service-process": "./lib/bundle.cjs"
2927
},
3028
"scripts": {
3129
"start": "node lib/process.js",
3230
"start:direct": "tsx src/process.ts",
33-
"build": "esbuild ./src/process.ts --bundle --platform=node --format=cjs --outfile=lib/bundle.cjs",
31+
"build": "esbuild ./src/process.ts --bundle --platform=node --format=cjs --banner:js=\"#!/usr/bin/env node\" --outfile=lib/bundle.cjs",
32+
"prepublishOnly": "npm run build",
3433
"create:executable": "npm run build && shx mkdir -p bin && node --experimental-sea-config sea-config.json && node scripts/sea-build.mjs"
3534
},
3635
"dependencies": {

packages/open-collaboration-service-process/scripts/sea-build.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { inject } from 'postject'
88
* The resulting executable can be run as a standalone application without the need of nodejs being installed
99
*/
1010

11-
var EXECUTABLE_NAME = 'oct-service-process'
11+
let EXECUTABLE_NAME = 'oct-service-process'
12+
const EXECUTABLE_PATH = `bin/${EXECUTABLE_NAME}`
1213

1314
if (process.platform === 'win32') {
1415
EXECUTABLE_NAME = EXECUTABLE_NAME + '.exe'
@@ -20,7 +21,7 @@ if (process.platform === 'win32') {
2021
const postjectOptions = { sentinelFuse: 'NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2' }
2122

2223
if (process.platform === 'darwin') {
23-
execSync(`codesign --remove-signature ${EXECUTABLE_NAME}`)
24+
execSync(`codesign --remove-signature ${EXECUTABLE_PATH}`)
2425
postjectOptions.machoSegmentName = 'NODE_SEA'
2526
}
2627

@@ -29,5 +30,5 @@ console.log('injecting ', process.cwd() + '/bin/sea-prep.blob', 'into ', process
2930
inject(process.cwd() + '/bin/' + EXECUTABLE_NAME, 'NODE_SEA_BLOB', fs.readFileSync(process.cwd() + '/bin/sea-prep.blob'), postjectOptions)
3031

3132
if (process.platform === 'darwin') {
32-
execSync(`codesign --sign - ${EXECUTABLE_NAME}`)
33+
execSync(`codesign --sign - ${EXECUTABLE_PATH}`)
3334
}

0 commit comments

Comments
 (0)