Skip to content

Commit e0b4eda

Browse files
committed
feat: Refactor Actions and fix docker
1 parent ccc1583 commit e0b4eda

File tree

6 files changed

+48
-50
lines changed

6 files changed

+48
-50
lines changed

.github/workflows/npm-publish.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/dockerhub-build-publish.yml renamed to .github/workflows/publish.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
1-
name: Build and publish Docker image
1+
name: Publish
22

33
on:
44
release:
55
types: [published]
66

77
jobs:
8+
npm-publish:
9+
environment:
10+
name: npm-bmssp
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [24.x]
17+
18+
permissions:
19+
contents: read
20+
id-token: write
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v5
25+
26+
- name: Setup Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: 'npm'
31+
registry-url: 'https://registry.npmjs.org'
32+
33+
- name: Install npm dependencies
34+
run: npm ci
35+
36+
- name: Publish npm package
37+
run: npm publish --provenance --access public
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
841
docker-build-and-publish:
42+
needs: npm-publish
43+
944
environment:
1045
name: dockerhub
1146

@@ -15,7 +50,7 @@ jobs:
1550
contents: read
1651

1752
steps:
18-
- name: Docker meta
53+
- name: Docker metadata
1954
id: meta
2055
uses: docker/metadata-action@v5
2156
with:

Dockerfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
FROM node:24-alpine
22

3-
WORKDIR /app
3+
WORKDIR /bmssp-js
44

5-
# Copy package files and install dependencies
6-
COPY package*.json ./
7-
RUN npm install
5+
RUN npm install bmssp
86

9-
# Mount src/ directory as a volume
10-
VOLUME ["src/", "test/"]
7+
COPY examples/main.js .
118

12-
# Default command (can be overridden)
13-
CMD ["node", "test/main.js"]
9+
CMD ["node", "main.js"]

examples/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { printMessage } from "bmssp";
2+
3+
printMessage("Hello, World!");

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "bmssp",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"description": "Javascript package implementation of the bmssp algorithm.",
5+
"main": "src/bmssp.mjs",
56
"keywords": [
67
"shortest-paths",
78
"bmssp",

0 commit comments

Comments
 (0)