Adding npmrc for private registry with workflowBootstrapSteps fails on build.yml / package-js
See original GitHub issueIn reference to #1006, we added the following snippet to our .projenrc.ts
:
const project = new awscdk.AwsCdkConstructLibrary({
//...
workflowBootstrapSteps: [
{
name: 'Login to GitHub npm registry',
id: 'npm_auth',
run: 'echo -e "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> ~/.npmrc',
env: {
'NPM_TOKEN': '${{ secrets.NPM_PULL_SECRET }}'
},
},
],
});
This will work for the initial jobs of the build.yml
and release.yml
workflows but will fail on the the following jobs as the $HOME
directory is not shared between jobs.
Therefore the Install Dependencies
steps of build.yml/package-js
and release.yml/release_npm
workflows/jobs will fail.
Pleas advise if this is a bug or if we are using the wrong API for what we need to do.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Github Actions step fails to detect packages from private NPM ...
Hello. I'm giving SWA some advanced scenario where I've published a private package on Github Packages Registry in a repo I own, then...
Read more >Using private packages in a CI/CD workflow - npm Docs
Create a new access token that will be used only to access npm packages from a CI/CD server. Continuous integration. When generating an...
Read more >npm install fails due private packages not found although the ...
I was able to fix this issue by modifying the .npmrc file like below: //registry.npmjs.com/:_authToken=${authToken}.
Read more >Set up your client's npmrc - Azure Artifacts - Microsoft Learn
How to set up your project and authenticate to Azure Artifacts feeds.
Read more >Install NPM Private Packages in CI/CD with GitHub Actions
Let's create a .npmrc file to install packages from @myregistry scoped registry and also add the token for installing private components if ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anyone needing a workaround in the interrim, this works:
I’m trying to build an
AwsCdkConstructLibrary
that publishes a JS (NPM) and Java (Maven) artifact to my (private) GitHub repository. The publishing itself is working fine. However, I’m also relying on another constructs library that is available in a private GitHub repository. For this reason each time thatyarn install
runs it requires a pointer and the credentials (GitHub token) to download the private dependency.Initially I have been the same approach like @5nafu with the same issue. Release to npm/java didn’t get the
workflowBootstrapSteps
steps andyarn install
failed.Using the suggestion from @mpiltz I have now been able to have all
yarn install
steps successfully download the dependency. But I’m now at a point wheremaven
in the java packaging task also requires the repository location and credentials to access the Java version of the private constructs dependency. I don’t know yet how to add a maven repository definition to the maven packaging task.I assume that publishing a Python artifact would have a similar issue.