Skip to content

Set up OpenID Connect to publish NPM packages from GitHub Actions #7

@eliot-akira

Description

@eliot-akira

NPM: Trusted Publishers for GitHub Actions

https://docs.npmjs.com/trusted-publishers#for-github-actions

GitHub: OpenID Connect reference

https://docs.github.com/en/actions/reference/security/oidc

Find information about using OpenID Connect (OIDC) to authenticate GitHub Actions workflows with cloud providers


Related to our discussion about automated workflow for NPM and GitHub, particularly:

I saw this announcement that will likely affect the setup we figured out.

NPM: Important changes to authentication and token management

Granular npm access token lifetime limits

Starting in mid-October, all newly created write-enabled granular access tokens for npm will have:

  • A default expiration of seven days, reduced from 30 days.
  • A maximum expiration of 90 days, which used to be unlimited.

So any NPM auth token we added as org/repo-level secret will expire frequently.

They recommend a more frequent token rotation strategy (which would have to be automated); or setting up OpenID Connect (OIDC) authentication between GitHub and NPM.

Trusted publishing for npm packages: Configuring GitHub Actions

Unfortunately it looks like this cannot be automated, and needs to be set up for each NPM package. So far I believe it affects:

  • @tangible/fields
  • @tangible/roller

But there will likely be more in the future, for frontend and server-side libraries, modules, tools. For example, @tangible/ui.


@zinigor I wanted to ask your thoughts on it, how we can solve this without too much maintenance effort.

I'm hoping the tangiblebot user on NPM and maybe a corresponding GitHub user can help with automating some of it. A possible idea is to use a dedicated repo with GitHub Actions to run scheduled tasks.


The reason this issue is in the Pipeline module is that the question of publishing NPM packages is part of a larger automated workflow being solved and developed.

Ideally, as we figure out various aspects of the build/test/release lifecycle for a project, the knowledge (documentation) and code can be extracted into a general-purpose workflow in this shared pipeline. Then new projects can benefit from it and have a simpler setup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions