Skip to content

Commit

Permalink
Automate npm publish
Browse files Browse the repository at this point in the history
- Also replace `npm i` with `npm ci` in other workflow targets.
- Also fix `README.md` being accidentally published as npm package `README.md`.
  • Loading branch information
jcreedcmu committed Mar 23, 2024
1 parent 41d4331 commit a5c7889
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Simple workflow for deploying static content to GitHub Pages
name: Publish NPM package

on:
# Runs on pushes targeting the deploy branch
push:
branches: ["publish"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- name: Install node modules
run: npm ci

- name: Build
env:
NPM_AUTH_TOKEN: "${{ secrets.NPM_PUBLISH_TOKEN }}"
run: make ci-publish
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
node-version: 18.x

- name: Run tests
run: npm install && npx jest
run: npm ci && npx jest
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
node-version: 18.x

- name: Install node modules
run: npm i
run: npm ci

- name: Build
run: make build
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ test:
npm run test-watch

# publish to npm
publish:
ci-publish:
make build-lib
cp README.npm-lib.md README.md
npm run test
npm publish

Expand Down
8 changes: 8 additions & 0 deletions README.npm-lib.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Twelf on Wasm Support
=====================

What we publish as an npm library as package `twelf-wasm` is just a
small library. The intended use is for libary users (specifically the
Twelf wiki) to conveniently construct url-fragment arguments with the
`encode` function so that they can link to twelf-wasm and have it load
a particular bit of twelf code at startup.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"require": "./lib/encoding.cjs"
},
"types": "lib/encoding.d.ts",
"version": "0.1.2",
"version": "0.1.3",
"description": "Running Twelf as a webassembly binary in a web page",
"homepage": "https://jcreedcmu.github.io/twelf-wasm/",
"bugs": {
Expand Down

0 comments on commit a5c7889

Please sign in to comment.