Skip to content

Commit 271ba09

Browse files
committed
CI/CD for npm
1 parent 1f3a540 commit 271ba09

3 files changed

Lines changed: 126 additions & 2 deletions

File tree

.github/workflows/merge-main.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: PR Merged -> main
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
jobs:
8+
linting:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4.1.1
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4.0.1
17+
with:
18+
node-version: 20
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Run ESLint
24+
run: npm run lint
25+
26+
build:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4.1.1
32+
33+
- name: Set up Node.js
34+
uses: actions/setup-node@v4.0.1
35+
with:
36+
node-version: 20
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: Build
42+
run: npm run build
43+
44+
publish:
45+
needs: [linting, build]
46+
runs-on: ubuntu-latest
47+
if: always() && needs.linting.result == 'success' && needs.build.result == 'success'
48+
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v4.1.1
52+
53+
- name: Set up Node.js
54+
uses: actions/setup-node@v4.0.1
55+
with:
56+
node-version: 20
57+
registry-url: 'https://registry.npmjs.org'
58+
59+
- name: Install dependencies
60+
run: npm ci
61+
62+
- name: Build
63+
run: npm run build
64+
65+
- name: Check if version changed
66+
id: version-check
67+
run: |
68+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
69+
NPM_VERSION=$(npm view n8n-nodes-linked-api version 2>/dev/null || echo "0.0.0")
70+
if [ "$PACKAGE_VERSION" != "$NPM_VERSION" ]; then
71+
echo "should_publish=true" >> $GITHUB_OUTPUT
72+
echo "Version changed: $NPM_VERSION -> $PACKAGE_VERSION"
73+
else
74+
echo "should_publish=false" >> $GITHUB_OUTPUT
75+
echo "Version unchanged: $PACKAGE_VERSION"
76+
fi
77+
78+
- name: Publish to npm
79+
if: steps.version-check.outputs.should_publish == 'true'
80+
run: npm publish
81+
env:
82+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/pr-main.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: PR Sent -> main
2+
3+
on:
4+
pull_request:
5+
branches: ['main']
6+
7+
jobs:
8+
linting:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4.1.1
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4.0.1
17+
with:
18+
node-version: 20
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Run ESLint
24+
run: npm run lint
25+
26+
build:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4.1.1
32+
33+
- name: Set up Node.js
34+
uses: actions/setup-node@v4.0.1
35+
with:
36+
node-version: 20
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: Build
42+
run: npm run build

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "n8n-nodes-linked-api",
3-
"version": "0.0.13",
4-
"description": "n8n nodes for Linked API - LinkedIn automation and data retrieval",
3+
"version": "1.0.0",
4+
"description": "Connect your LinkedIn accounts to n8n's automation platform.",
55
"keywords": [
66
"n8n-community-node-package",
77
"n8n-nodes",

0 commit comments

Comments
 (0)