Skip to content

Commit 290da6d

Browse files
authored
Rearrange GitHub Actions to allow publishing to NPM (#1081)
* 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 * Update RELEASE doc
1 parent cb869b9 commit 290da6d

File tree

5 files changed

+55
-37
lines changed

5 files changed

+55
-37
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

RELEASE.md

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# Robot Web Tools Module Release TODOs
2-
3-
This document describes TODOs and checklists in order to release
4-
Robot Web Tool javascript modules([roslibjs](https://github.com/RobotWebTools/roslibjs), [ros2djs](https://github.com/RobotWebTools/ros2djs), [ros3djs](https://github.com/RobotWebTools/ros3djs)).
1+
# How to release roslibjs
52

63
## 0. Make sure that the releasing module is compatible with other RWT modules
74

@@ -13,36 +10,14 @@ docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator
1310

1411
## 2. Bump a new version
1512

16-
* Version bump in package.json, bower.json, and in the main file. e.g) [RosLib.js](src/RosLib.js)
13+
* Version bump in [package.json](./package.json)
1714
* Tag the version
1815

19-
## 3. Release modules
20-
21-
### NPM
22-
23-
Publish the module. We publish in the global scope.
24-
25-
* `npm publish`
26-
27-
### CDN
28-
29-
Hosted via the [JsDelivr](https://www.jsdelivr.com/) CDN, which takes it directly from the repo.
30-
31-
## 4. Create GitHub Release
16+
## 3. Create GitHub Release
3217

3318
* Create a new GitHub release based on the new git tag.
3419
* Add the version number as release title (Without leading `v`).
3520
* Let GitHub auto-generate the Changelog
3621
* Mark `Set as latest release`
3722
* Publish release
38-
39-
## 5. Update JSdocs in Robot Web Tools website
40-
41-
The JSdocs are update automatically by GitHub Actions [config](.github/workflows/docs.yml). The GitHub release created above, will trigger this run. The docs are hosted in their own repository at the `gh-pages` branch.
42-
43-
## 6. Sync `develop` branch with `master`
44-
45-
`Master` branch should represent the latest release.
46-
47-
* Create a PR against `master` from `develop`
48-
* Do *Rebase and merge* to have the same history as `develop` branch
23+
* [The CD action](.github/workflows/cd.yml) will automatically publish the docs to the website and publish the package to npm.

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)