(cli) trouble publishing to private github packages
See original GitHub issueAffected Packages
changeset:cli
Problem
I am using the changeset/cli (version, publish) in my github actions workflow for a private GH repo in a private GH organization.
I had npx changeset version
working for a moment, using unscoped package names, and npx changeset publish
was failing.
In order to fix publish
, I learned that Github Packages needs package names to be “scoped”. I changed all my package*.json files, code imports and dependencies to use @my-org/some-pkg
.
Now npx changeset version
is failing.
I’m seeing these errors (below) in github action after I merge a PR to main. What’s interesting to note is the old package name dslio
appears, but it should say @my-org/dslio
. Perhaps the problem is the unscoped name comes from a previous commit?
The only place in my repo where this name appears unscoped is in packages/dslio/CHANGELOG.md
. Could the CHANGELOG file be the culprit?
Run npx changeset version
🦋 error Error: Could not find package information for dslio
🦋 error at /home/runner/work/ods/ods/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js:279:15
🦋 error at Array.forEach (<anonymous>)
🦋 error at /home/runner/work/ods/ods/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js:271:44
🦋 error at Array.forEach (<anonymous>)
🦋 error at flattenReleases (/home/runner/work/ods/ods/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js:266:14)
🦋 error at Object.assembleReleasePlan [as default] (/home/runner/work/ods/ods/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js:496:18)
🦋 error at version (/home/runner/work/ods/ods/node_modules/@changesets/cli/dist/cli.cjs.dev.js:599:60)
🦋 error at async run$2 (/home/runner/work/ods/ods/node_modules/@changesets/cli/dist/cli.cjs.dev.js:1337:[11](https://github.com/wm-msc-malt/ods/runs/6588470015?check_suite_focus=true#step:9:12))
Error: Process completed with exit code 1.
Here is my GH workflow.
name: Release
on:
# pull_request_target:
# types:
# - "closed"
push:
branches:
- main
env:
AWS_REGION: us-west-2
HUSKY: 0
NPM_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
# if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Show GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
# https://github.com/marketplace/actions/github-script
# - name: View context attributes
# uses: actions/github-script@v6
# with:
# script: console.log(context)
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: "npm"
- name: Update NPM
run: npm install -g npm@8.9
- name: Install Dependencies
run: npm ci
- name: Setup NX
uses: nrwl/nx-set-shas@v2
# main-branch-name: 'main'
- run: |
echo "BASE: ${{ env.NX_BASE }}"
echo "HEAD: ${{ env.NX_HEAD }}"
npx nx affected:apps
- name: Changeset Version
# you should not commit any changes between calling version and publish
# https://github.com/changesets/changesets/tree/main/packages/cli#publish
run: |
npx changeset version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NX Build Affected Packages
run: npm run ci-affected-build
- name: Changeset Publish
# you should not commit any changes between calling version and publish
# https://github.com/changesets/changesets/tree/main/packages/cli#publish
run: |
npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # example from https://www.christopherbiscardi.com/post/shipping-multipackage-repos-with-github-actions-changesets-and-lerna
# - name: Publish Affected Packages
# run: npm run ci-affected-publish
# env:
# NPM_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Create Release Pull Request
# uses: changesets/action@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Git Identity
# run: |
# git config --global user.name 'github-actions[bot]'
# git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Proposed solution
No idea.
Issue Analytics
- State:
- Created a year ago
- Comments:13
Top GitHub Comments
It worked! It’s done. Finally.
Adding the
https
url (not thegit
url) to each package was the final piece of the puzzle. https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#publishing-multiple-packages-to-the-same-repositorythanks @pmcelhaney for the support!
I fixed the Github registry problem. Now I’m looking at this:
I wonder if the action assumes I published once before. I’ll try to publish from my local using a PAT.