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
1 change: 1 addition & 0 deletions .dagger/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func (m *Openmeter) publishPythonSdk(ctx context.Context, version string, pypiTo
return err
}

// TODO: keep in sync with api/client/javascript/Makefile for now, if the release process is moved to nix, can be removed
func (m *Openmeter) PublishJavascriptSdk(ctx context.Context, version string, tag string, npmToken *dagger.Secret) error {
// TODO: generate SDK on the fly?
_, err := dag.Container().
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/sdk-javascript-dev-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: JavaScript SDK Beta Release

permissions:
contents: read

on:
workflow_dispatch:
push:
branches:
- main

jobs:
release-beta-sdk:
name: JavaScript SDK Beta Release
runs-on: depot-ubuntu-latest-8

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.head_ref }}

- name: Get short SHA
id: get-short-sha
run: |
id=$(echo ${{github.sha}} | cut -c 1-12)
echo "id=${id}" >> $GITHUB_OUTPUT

- name: Configure registry auth
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc

- name: Set up Nix
uses: nixbuild/nix-quick-install-action@63ca48f939ee3b8d835f4126562537df0fee5b91 # v32
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
keep-env-derivations = true
keep-outputs = true

- name: Restore Nix store
uses: nix-community/cache-nix-action/restore@135667ec418502fa5a3598af6fb9eb733888ce6a # v6.1.3
with:
primary-key: ${{ runner.os }}-openmeter-nix-build-${{ github.ref_name }}-${{ hashFiles('flake.*') }}
restore-prefixes-first-match: |
${{ runner.os }}-openmeter-nix-build-${{ github.ref_name }}-
${{ runner.os }}-openmeter-nix-build-main-${{ hashFiles('flake.*') }}
${{ runner.os }}-openmeter-nix-build-main-
${{ runner.os }}-openmeter-nix-build-

- name: Publish NPM package
run: |
nix develop --impure .#ci -c make -C api/client/javascript publish-javascript-sdk
env:
JS_SDK_RELEASE_VERSION: 1.0.0-beta-${{steps.get-short-sha.outputs.id}}
JS_SDK_RELEASE_TAG: beta
39 changes: 0 additions & 39 deletions .github/workflows/sdk-javascript-release.yaml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/sdk-javascript.yaml

This file was deleted.

21 changes: 21 additions & 0 deletions api/client/javascript/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ generate: ## Generate JavaScript SDK
pnpm build
pnpm test

# Warning: keep in sync with .dagger/release.go for now
.PHONY: publish-javascript-sdk
publish-javascript-sdk: ## Publish JavaScript SDK
$(call print-target)
@if [ -z "$$JS_SDK_RELEASE_VERSION" ]; then \
echo "ERROR: JS_SDK_RELEASE_VERSION is required"; \
echo "Usage: JS_SDK_RELEASE_VERSION=1.2.3 make publish-javascript-sdk [JS_SDK_RELEASE_TAG=beta]"; \
exit 1; \
fi

@if [ -z "$$JS_SDK_RELEASE_TAG" ]; then \
echo "ERROR: JS_SDK_RELEASE_TAG is required"; \
echo "Usage: JS_SDK_RELEASE_VERSION=1.2.3 make publish-javascript-sdk [JS_SDK_RELEASE_TAG=beta]"; \
exit 1; \
fi

pnpm --frozen-lockfile install
pnpm version "$${JS_SDK_RELEASE_VERSION}" --no-git-tag-version
CACHE_BUSTER="$$(date --rfc-3339=seconds)" pnpm publish --no-git-checks --tag "$${JS_SDK_RELEASE_TAG}"
@echo "✅ Published $${JS_SDK_RELEASE_TAG} JavaScript SDK version $${JS_SDK_RELEASE_VERSION} with tag $${JS_SDK_RELEASE_TAG}"

.PHONY: help
.DEFAULT_GOAL := help
help:
Expand Down