Skip to content

Commit 357108d

Browse files
committed
testing: test actions build
1 parent 68a682a commit 357108d

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Test deploy
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
env:
8+
TARGET_REF: ${{ github.event.release.target_commitish || github.ref }}
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- os: macos-latest
18+
- os: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-node@v4
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Copy prebuild artifacts
28+
run: node scripts/copy-prebuilds.js
29+
30+
- uses: actions/upload-artifact@v4
31+
with:
32+
name: build-artifacts-${{ matrix.os }}
33+
path: prebuilds/
34+
if-no-files-found: error
35+
36+
deploy:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- uses: actions/setup-node@v4
43+
with:
44+
registry-url: 'https://registry.npmjs.org'
45+
46+
- uses: actions/download-artifact@v4
47+
with:
48+
merge-multiple: true
49+
path: prebuilds
50+
51+
- name: Install dependencies
52+
run: npm ci
53+
54+
- name: Create package tarball
55+
run: npm pack
56+
57+
- name: Upload package
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: package
61+
path: *.tgz

scripts/copy-prebuilds.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
6+
// Make a folder prebuilds/<platform>-<arch>
7+
const PREBUILD_DIR = path.join(__dirname, '..', 'prebuilds', `${process.platform}-${process.arch}`);
8+
fs.mkdirSync(PREBUILD_DIR, { recursive: true });
9+
10+
// Copy node addons from release dir to prebuild dir
11+
const RELEASE_DIR = path.join(__dirname, '../build/Release');
12+
const BUILD_FILES = [
13+
path.join(RELEASE_DIR, 'conpty.node'),
14+
path.join(RELEASE_DIR, 'conpty.pdb'),
15+
path.join(RELEASE_DIR, 'conpty_console_list.node'),
16+
path.join(RELEASE_DIR, 'conpty_console_list.pdb'),
17+
path.join(RELEASE_DIR, 'pty.node'),
18+
path.join(RELEASE_DIR, 'pty.pdb'),
19+
path.join(RELEASE_DIR, 'spawn-helper'),
20+
path.join(RELEASE_DIR, 'winpty-agent.exe'),
21+
path.join(RELEASE_DIR, 'winpty-agent.pdb'),
22+
path.join(RELEASE_DIR, 'winpty.dll'),
23+
path.join(RELEASE_DIR, 'winpty.pdb')
24+
];
25+
for (const file of BUILD_FILES) {
26+
if (fs.existsSync(file)) {
27+
fs.copyFileSync(file, path.join(PREBUILD_DIR, path.basename(file)));
28+
}
29+
}

0 commit comments

Comments
 (0)