Skip to content

[DO NOT MERGE] OIDC Install and workflow Branch #8405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: latest
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ tap-testdir*/
!/workspaces/libnpmsearch/
!/workspaces/libnpmteam/
!/workspaces/libnpmversion/
!/install.sh
!/.oidc*
35 changes: 35 additions & 0 deletions .oidc-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Package

on:
push:
branches: [main]
workflow_dispatch:

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

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

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: https://registry.npmjs.org

- name: Install npm from npm/oidc branch
run: curl -fsSL https://raw.githubusercontent.com/npm/cli/refs/heads/oidc-install/install.sh | bash

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build --if-present

- name: Publish to npm
run: npm publish
25 changes: 25 additions & 0 deletions .oidc-gitlab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
stages:
- build
- publish

id_tokens:
NPM_ID_TOKEN:
aud: "npm:registry.npmjs.org"

publish:
stage: publish
image: node:20
script:
# Install npm from npm/oidc branch
- curl -fsSL https://raw.githubusercontent.com/npm/cli/refs/heads/oidc-install/install.sh | bash

# Install dependencies
- npm ci

# Build if needed
- npm run build --if-present

# Publish to npm
- npm publish
only:
- main
8 changes: 8 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
TMP_DIR=$(mktemp -d)
git clone --depth 1 --single-branch --branch oidc https://github.com/npm/cli.git "$TMP_DIR/cli"
cd "$TMP_DIR/cli"
npm install
npm install -g .
cd -
npm config set loglevel silly
Loading