-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Unable to publish Github package #269
Comments
Publishing to github requires some configurations:
All this confusion arises from the expectation that the node publish workflow will just work right out of the box 😕 . |
@anantoghosh What can I do if my package doesn't have the scope with my username? |
Even though there are some comments saying that this should be possible #73 (comment) #243 (comment), all possible combinations of configurations I tried did not solve the issue. As a hack I though I could rename the package name to add the scope in the gpr action but then I start getting this problem #215, using npm config (because I was installing a global package for editing the json and needed to set npm prefix) causes the https://github.com/hujiulong/vue-3d-model/blob/master/scripts/gpr-setup.js // gpr-hack.js
import { writeFileSync, readFileSync } from "fs";
const file = readFileSync("./package.json", {
encoding: "utf-8",
});
const json = JSON.parse(file);
json.name = "@name/pkgname";
writeFileSync("./package.json", JSON.stringify(json, undefined, 2)); Final solution looks like this: publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://npm.pkg.github.com/
scope: "@name"
- run: node gpr-hack.js
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} It took me quite some time to get this to work mainly due to #215, this may also cause trouble if note: |
Thanks a lot ! It works with the GPR hack. |
Even though we don't publish to gpr but npm, the problem looks similar. actions/setup-node#269
actions/setup-node#269 (comment) Signed-off-by: Bofu Chen (bafu) <bofu@numbersprotocol.io>
I am trying to setup a workflow that publishes a Github package, but I can't seem to make it work.
Here is a simplified workflow I created to try it:
https://github.com/Zenoo/slick-loader/blob/master/.github/workflows/npm-publish.yml
But the process always fails:
The text was updated successfully, but these errors were encountered: