Skip to content

Commit f355d3d

Browse files
committed
bump patch version, add github actions publishing
1 parent e3f07f2 commit f355d3d

File tree

2 files changed

+104
-4
lines changed

2 files changed

+104
-4
lines changed

.github/workflows/main.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
version-check:
14+
name: Check Version
15+
runs-on: ubuntu-latest
16+
outputs:
17+
version_changed: ${{ steps.check.outputs.version_changed }}
18+
new_version: ${{ steps.check.outputs.new_version }}
19+
20+
steps:
21+
- name: Checkout Code
22+
uses: actions/checkout@v4
23+
24+
- name: Check the version
25+
id: check
26+
run: |
27+
CURRENT_VERSION=$(jq -r .version package.json)
28+
echo "Current version: $CURRENT_VERSION"
29+
LATEST_VERSION=$(npm view @mercuryworkshop/wisp-js versions --json | jq -r '.[-1]' || echo "0.0.0")
30+
echo "Latest NPM version: $LATEST_VERSION"
31+
32+
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ];
33+
then
34+
echo "Version changed"
35+
echo "version_changed=true" >> "$GITHUB_OUTPUT"
36+
echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
37+
else
38+
echo "Version not changed"
39+
echo "version_changed=false" >> "$GITHUB_OUTPUT"
40+
fi
41+
42+
build:
43+
name: Build wisp-js
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Setup Node.js
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: "22"
54+
cache: "npm"
55+
56+
- name: Install npm dependencies
57+
run: npm install
58+
59+
- name: Pack wisp-js
60+
run: npm pack
61+
62+
- name: Upload Artifact (packaged)
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: packaged-wisp-js
66+
path: mercuryworkshop-wisp-js-*.tgz
67+
68+
- name: Upload Artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: wisp-js
72+
path: |
73+
dist
74+
lib
75+
76+
publish:
77+
name: Publish wisp-js to NPM
78+
runs-on: ubuntu-latest
79+
needs: [version-check, build]
80+
permissions: write-all
81+
if: github.ref == 'refs/heads/master' && needs.version-check.outputs.version_changed == 'true'
82+
83+
steps:
84+
- name: Setup Node.js
85+
uses: actions/setup-node@v4
86+
with:
87+
node-version: "22"
88+
registry-url: "https://registry.npmjs.org"
89+
90+
- name: Get artifacts
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: packaged-wisp-js
94+
path: .
95+
96+
- name: Update npm
97+
run: npm install -g npm@latest
98+
99+
- name: Publish
100+
run: npm publish mercuryworkshop-wisp-js-${{ needs.version-check.outputs.new_version }}.tgz --access public --no-git-checks

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "@mercuryworkshop/wisp-js",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "A client and server for the Wisp protocol, written in Javascript",
55
"repository": {
66
"type": "git",
7-
"url": "git+https://github.com/MercuryWorkshop/wisp-client-js.git"
7+
"url": "git+https://github.com/MercuryWorkshop/wisp-js.git"
88
},
99
"author": "MercuryWorkshop",
1010
"license": "AGPL-3.0",
1111
"bugs": {
12-
"url": "https://github.com/MercuryWorkshop/wisp-client-js/issues"
12+
"url": "https://github.com/MercuryWorkshop/wisp-js/issues"
1313
},
14-
"homepage": "https://github.com/MercuryWorkshop/wisp-client-js#readme",
14+
"homepage": "https://github.com/MercuryWorkshop/wisp-js#readme",
1515
"main": "./src/index.mjs",
1616
"exports": {
1717
".": {

0 commit comments

Comments
 (0)