Skip to content

Commit

Permalink
Merge pull request #867 from openmeterio/fix-node-release
Browse files Browse the repository at this point in the history
ci: fix node release
  • Loading branch information
sagikazarmark authored May 7, 2024
2 parents 887a7b3 + 8aac360 commit 90502eb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ci/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"path"
"strings"
"time"
)
Expand Down Expand Up @@ -129,22 +130,22 @@ func (m *Ci) publishPythonSdk(ctx context.Context, version string, pypiToken *Se

func (m *Ci) publishNodeSdk(ctx context.Context, version string, npmToken *Secret) error {
// TODO: generate SDK on the fly?
return m.publishToNpm(ctx, m.Source.Directory("api/client/node"), version, npmToken)
return m.publishToNpm(ctx, "node", version, npmToken)
}

func (m *Ci) publishWebSdk(ctx context.Context, version string, npmToken *Secret) error {
// TODO: generate SDK on the fly?
return m.publishToNpm(ctx, m.Source.Directory("api/client/web"), version, npmToken)
return m.publishToNpm(ctx, "web", version, npmToken)
}

func (m *Ci) publishToNpm(ctx context.Context, pkg *Directory, version string, npmToken *Secret) error {
func (m *Ci) publishToNpm(ctx context.Context, pkg string, version string, npmToken *Secret) error {
_, err := dag.Container().
From("node:20-alpine").
WithExec([]string{"npm", "install", "-g", "pnpm"}).
WithExec([]string{"sh", "-c", "echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > /root/.npmrc"}).
WithSecretVariable("NPM_TOKEN", npmToken).
WithDirectory("/work", pkg).
WithWorkdir("/work").
WithDirectory("/work", m.Source.Directory("api")).
WithWorkdir(path.Join("/work/client", pkg)).
WithExec([]string{"pnpm", "install", "--frozen-lockfile"}).
WithExec([]string{"pnpm", "version", version, "--no-git-tag-version"}).
WithEnvVariable("CACHE_BUSTER", time.Now().Format(time.RFC3339Nano)).
Expand Down

0 comments on commit 90502eb

Please sign in to comment.