Skip to content

Commit 881a642

Browse files
Merge pull request #1 from savetheclocktower/ci-publishing
Prepare for auto-publishing to `@pulsar-edit/keyboard-layout` on NPM
2 parents 4cb2563 + 7f657a5 commit 881a642

File tree

5 files changed

+84
-19
lines changed

5 files changed

+84
-19
lines changed

.github/workflows/ci.yml

+38-13
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,51 @@
11
name: CI
22

3-
on: [push]
4-
5-
env:
6-
CI: true
3+
on:
4+
push:
5+
pull_request:
76

87
jobs:
98
Test:
9+
name: "Test"
10+
runs-on: ${{ matrix.os }}
1011
strategy:
12+
fail-fast: false
1113
matrix:
12-
os: [ubuntu-latest, macos-latest, windows-latest]
13-
runs-on: ${{ matrix.os }}
14+
os:
15+
- ubuntu-latest
16+
- macos-latest
17+
- windows-latest
18+
node_version:
19+
- 16
1420
steps:
15-
- uses: actions/checkout@v1
16-
- uses: actions/setup-node@v2
21+
- uses: actions/checkout@v4
22+
23+
- name: Install Node ${{ matrix.node }}
24+
uses: actions/setup-node@v4
1725
with:
18-
node-version: '14'
19-
- name: Install windows-build-tools
20-
if: ${{ matrix.os == 'windows-latest' }}
21-
run: npm config set msvs_version 2019
26+
node-version: ${{ matrix.node_version }}
27+
28+
- name: Install dependencies (Linux)
29+
run: sudo apt install libx11-dev libxkbfile-dev
30+
if: "contains(matrix.os, 'ubuntu')"
31+
32+
- name: Install Python setuptools
33+
# This is needed for Python 3.12+, since many versions of node-gyp
34+
# are incompatible with Python 3.12+, which no-longer ships 'distutils'
35+
# out of the box. 'setuptools' package provides 'distutils'.
36+
run: python3 -m pip install setuptools
37+
if: "!contains(matrix.os, 'macos')"
38+
39+
- name: Install Python setuptools (macOS)
40+
# This is needed for Python 3.12+, since many versions of node-gyp
41+
# are incompatible with Python 3.12+, which no-longer ships 'distutils'
42+
# out of the box. 'setuptools' package provides 'distutils'.
43+
run: brew install python-setuptools
44+
if: "contains(matrix.os, 'macos')"
45+
2246
- name: Install dependencies
23-
run: npm i
47+
run: npm install
48+
2449
- name: Run tests
2550
uses: GabrielBB/xvfb-action@v1
2651
with:

.github/workflows/publish.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: NPM Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
env:
9+
NODE_VERSION: 16
10+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
uses: GabrielBB/xvfb-action@v1
19+
with:
20+
node-version: ${{ env.NODE_VERSION }}
21+
- run: sudo apt install libx11-dev libxkbfile-dev
22+
- run: python3 -m pip install setuptools
23+
- run: npm ci
24+
- run: npm test
25+
26+
publish:
27+
needs: build
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: ${{ env.NODE_VERSION }}
34+
registry-url: https://registry.npmjs.org/
35+
- run: npm ci
36+
- run: npm publish --access public

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ npm-debug.log
44
*.swp
55
build
66
.vscode
7+
.cache
8+
.tool-versions
9+
compile_commands.json

binding.gyp

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
],
2727
'msvs_settings': {
2828
'VCCLCompilerTool': {
29-
'ExceptionHandling': 1, # /EHsc
29+
'ExceptionHandling': 1, # /EHsc
3030
'WarnAsError': 'true',
3131
},
3232
},
@@ -37,7 +37,8 @@
3737
4267, # conversion from 'size_t' to 'type', possible loss of data
3838
4302, # 'type cast': truncation from 'HKL' to 'UINT'
3939
4311, # 'type cast': pointer truncation from 'HKL' to 'UINT'
40-
4530, # C++ exception handler used, but unwind semantics are not enabled
40+
4530, # C++ exception handler used, but unwind semantics are not
41+
# enabled
4142
4506, # no definition for inline function
4243
4577, # 'noexcept' used with no exception handling mode specified
4344
4996, # function was declared deprecated

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "keyboard-layout",
2+
"name": "@pulsar-edit/keyboard-layout",
33
"version": "2.0.17",
44
"description": "Read and observe the current keyboard layout on OS X.",
55
"main": "./lib/keyboard-layout",
@@ -8,15 +8,15 @@
88
},
99
"repository": {
1010
"type": "git",
11-
"url": "https://github.com/atom/keyboard-layout.git"
11+
"url": "https://github.com/pulsar-edit/keyboard-layout.git"
1212
},
1313
"bugs": {
14-
"url": "https://github.com/atom/keyboard-layout/issues"
14+
"url": "https://github.com/pulsar-edit/keyboard-layout/issues"
1515
},
1616
"licenses": [
1717
{
1818
"type": "MIT",
19-
"url": "http://github.com/atom/keyboard-layout/raw/master/LICENSE.md"
19+
"url": "http://github.com/pulsar-edit/keyboard-layout/raw/master/LICENSE.md"
2020
}
2121
],
2222
"dependencies": {

0 commit comments

Comments
 (0)