Skip to content

Commit

Permalink
feat: add package for authenticating npm to artifact registry
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptammergard committed Nov 9, 2023
1 parent 4a0398b commit 8b2886e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tools/sgnpmartifactregistryauth/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package sgnpmartifactregistryauth

import (
"context"
"os/exec"

"go.einride.tech/sage/sg"
)

const (
name = "npm-artifact-registry-auth"
)

func Command(ctx context.Context, args ...string) *exec.Cmd {
sg.Deps(ctx, PrepareCommand)
return sg.Command(ctx, sg.FromBinDir(name), args...)
}

func PrepareCommand(ctx context.Context) error {
sg.Logger(ctx).Println("authenticating npm to artifact registry...")
if err := sg.Command(

Check failure on line 21 in tools/sgnpmartifactregistryauth/tools.go

View workflow job for this annotation

GitHub Actions / build

if-return: redundant if ...; err != nil check, just return error instead. (revive)
ctx,
"npx",
"google-artifactregistry-auth",
).Run(); err != nil {
return err
}
return nil
}

0 comments on commit 8b2886e

Please sign in to comment.