Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/npm-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: publish-npm

on:
release:
types:
- published

permissions:
id-token: write # Required for OIDC
contents: read

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
js:
name: JavaScript
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5

- name: setup bun
uses: oven-sh/setup-bun@v2
with:
registries: |
https://registry.npmjs.org/

- name: Install dependencies
run: bun install --frozen-lockfile

- name: build
run: make build

- name: Publish to npm
run: bunx npm publish --provenance # workaround for bun not supporting trusted publishing of npm (https://github.com/oven-sh/bun/issues/15601)
if: github.event_name == 'release'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ pip-delete-this-directory.txt
# see python README.md why this is required:
go/buf/
go/tests/mocks/buf

# js
node_modules/
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ BUILDDATE := $(shell date -Iseconds)
VERSION := $(or ${VERSION},$(shell git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD))
LOCALBIN ?= $(shell pwd)/bin

all: proto generate test
all: proto generate test build

release: proto generate test
release: proto generate test build

.PHONY: proto
proto: protolint
Expand All @@ -27,3 +27,7 @@ generate:
.PHONY: test
test:
$(MAKE) -C go test

.PHONY: build
build:
make -C js build VERSION=$(VERSION)
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ PN = "PN"
extend-exclude = [
"go.mod",
"go.sum",
"*.ts",
"*.js"
]
25 changes: 25 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions js/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
VERSION_STRIPPED := $(patsubst v%,%,$(VERSION))

.PHONY: install
install:
bun install -dd

.PHONY: clean
clean:
rm -rf metalstack

.PHONY: build
build: install
ifeq ($(CI),true)
cd .. &&\
yq e -i -o=json ".version=\"$(VERSION_STRIPPED)\"" package.json &&\
yq e -o=json ".version" package.json
endif
cd .. && bun run build
Loading
Loading