Skip to content

Commit 68ab9b8

Browse files
committed
wip: fix parallel publishing configuration
1 parent 305deb4 commit 68ab9b8

File tree

4 files changed

+3759
-22
lines changed

4 files changed

+3759
-22
lines changed

.github/workflows/main.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -348,27 +348,42 @@ jobs:
348348
echo "ℹ️ No README changes to stage"
349349
fi
350350
351-
- name: Setup npmrc for multiple registries
351+
- name: Prepare GitHub Packages package.json
352352
run: |
353-
echo "🔧 Setting up .npmrc for multiple registry publishing..."
353+
echo "📦 Preparing package configuration for GitHub Packages..."
354354
355-
# Configure for both NPM and GitHub Packages
356-
cat > .npmrc << EOF
357-
registry=https://registry.npmjs.org/
358-
//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
359-
//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}
360-
@exadev:registry=https://npm.pkg.github.com
361-
EOF
355+
# Create dist-github directory
356+
mkdir -p dist-github
362357
363-
echo "✅ Registry configuration completed"
358+
# Create a scoped package.json for GitHub Packages
359+
jq '.name = "@exadev/markmv" | .publishConfig.registry = "https://npm.pkg.github.com"' package.json > package-github.json
360+
361+
echo "✅ GitHub Packages configuration prepared"
364362
365363
- name: Release (includes README and badge updates)
366364
env:
367365
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
368366
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
369367
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
368+
# Environment variables for npm-multiple plugin
369+
NPMJS_NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
370+
NPMJS_NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
371+
GITHUB_NPM_CONFIG_REGISTRY: https://npm.pkg.github.com
372+
GITHUB_NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
370373
run: |
371374
echo "🚀 Starting semantic-release with staged README and badge updates..."
375+
376+
# Set up .npmrc for both registries
377+
cat > .npmrc << EOF
378+
registry=https://registry.npmjs.org/
379+
//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
380+
//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}
381+
@exadev:registry=https://npm.pkg.github.com
382+
EOF
383+
384+
# Copy the GitHub-scoped package.json to the directory
385+
cp package-github.json dist-github/package.json
386+
372387
npm run release
373388
echo "✅ Release completed - packages published to both NPM and GitHub Packages"
374389

.releaserc.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,24 @@
4444
],
4545
"@semantic-release/changelog",
4646
[
47-
"@semantic-release/npm",
47+
"@amanda-mitchell/semantic-release-npm-multiple",
4848
{
49-
"npmPublish": true,
50-
"tarballDir": "dist",
51-
"pkgRoot": "./",
52-
"provenance": true,
53-
"addChannel": false
54-
}
55-
],
56-
[
57-
"@semantic-release/exec",
58-
{
59-
"publishCmd": "echo 'Publishing to GitHub Packages...' && cp package.json package-github.json && jq '.name = \"@exadev/markmv\" | .publishConfig.registry = \"https://npm.pkg.github.com\"' package-github.json > temp.json && mv temp.json package-github.json && npm publish package-github.json --registry https://npm.pkg.github.com --provenance --access public && rm package-github.json"
49+
"registries": {
50+
"npmjs": {
51+
"npmPublish": true,
52+
"tarballDir": "dist",
53+
"pkgRoot": "./",
54+
"provenance": true,
55+
"addChannel": false
56+
},
57+
"github": {
58+
"npmPublish": true,
59+
"tarballDir": "dist-github",
60+
"pkgRoot": "./",
61+
"provenance": true,
62+
"addChannel": false
63+
}
64+
}
6065
}
6166
],
6267
[

0 commit comments

Comments
 (0)