Skip to content

Commit 9f2a12b

Browse files
committed
Rearrange GitHub Actions to allow publishing to NPM
also temporarily set the package.json version to 2.0.0-alpha1 so I don't accidentally clobber the 2.0.0 version while testing
1 parent 4bc27d7 commit 9f2a12b

File tree

4 files changed

+51
-8
lines changed

4 files changed

+51
-8
lines changed

.github/workflows/cd.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CD
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
permissions:
8+
contents: read
9+
id-token: write # Required to authenticate with npm
10+
11+
jobs:
12+
docs:
13+
uses: ./.github/workflows/docs.yml
14+
secrets: inherit
15+
with:
16+
deploy: true
17+
18+
publish:
19+
environment: npm
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v5
23+
- uses: actions/setup-node@v6
24+
with:
25+
node-version: lts
26+
registry-url: "https://registry.npmjs.org"
27+
- run: npm ci
28+
- run: npm run build
29+
- run: npm publish

.github/workflows/docs.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
name: Docs Deployment
22

33
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- develop
8-
release:
9-
types: [released]
104
workflow_dispatch:
5+
inputs:
6+
deploy:
7+
description: "Deploy to GitHub Pages"
8+
required: true
9+
type: boolean
10+
default: false
11+
12+
workflow_call:
13+
inputs:
14+
deploy:
15+
description: "Deploy to GitHub Pages"
16+
required: true
17+
type: boolean
18+
default: false
1119

1220
jobs:
1321
build:
@@ -39,7 +47,7 @@ jobs:
3947
# pages and id-token required to deploy to GitHub Pages
4048
pages: write
4149
id-token: write
42-
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
50+
if: inputs.deploy
4351
steps:
4452
- name: Deploy to GitHub Pages
4553
id: deployment

.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ jobs:
4141

4242
- name: Run tests
4343
run: npm test
44+
45+
docs:
46+
uses: ./.github/workflows/docs.yml
47+
secrets: inherit
48+
with:
49+
deploy: false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "roslib",
33
"homepage": "https://robotwebtools.github.io",
44
"description": "The standard ROS Javascript Library",
5-
"version": "2.0.0",
5+
"version": "2.0.0-alpha1",
66
"license": "BSD-2-Clause",
77
"files": [
88
"dist"

0 commit comments

Comments
 (0)