fix(ci): Use .npmrc for registry authentication in Gitea workflow and add conditional npmjs publish
This commit is contained in:
@@ -71,15 +71,19 @@ jobs:
|
|||||||
# Extract server host from GITHUB_SERVER_URL (remove https://)
|
# Extract server host from GITHUB_SERVER_URL (remove https://)
|
||||||
GITEA_HOST="${GITHUB_SERVER_URL#https://}"
|
GITEA_HOST="${GITHUB_SERVER_URL#https://}"
|
||||||
GITEA_REGISTRY="$GITHUB_SERVER_URL/api/packages/$GITHUB_REPOSITORY_OWNER/npm/"
|
GITEA_REGISTRY="$GITHUB_SERVER_URL/api/packages/$GITHUB_REPOSITORY_OWNER/npm/"
|
||||||
# Configure Gitea npm registry
|
|
||||||
npm config set @${GITHUB_REPOSITORY_OWNER}:registry "$GITEA_REGISTRY"
|
# Create .npmrc for Gitea authentication
|
||||||
npm config set "//${GITEA_HOST}/api/packages/${GITHUB_REPOSITORY_OWNER}/npm/:_authToken" "$GITEA_TOKEN"
|
echo "@${GITHUB_REPOSITORY_OWNER}:registry=${GITEA_REGISTRY}" > .npmrc
|
||||||
|
echo "//${GITEA_HOST}/api/packages/${GITHUB_REPOSITORY_OWNER}/npm/:_authToken=${GITEA_TOKEN}" >> .npmrc
|
||||||
|
|
||||||
# Publish to Gitea
|
# Publish to Gitea
|
||||||
pnpm publish --no-git-checks
|
pnpm publish --no-git-checks
|
||||||
|
|
||||||
# Conditionally publish to npmjs.org if token exists
|
# Conditionally publish to npmjs.org if token exists
|
||||||
if [ -n "$NPMCI_TOKEN_NPM" ]; then
|
if [ -n "$NPMCI_TOKEN_NPM" ]; then
|
||||||
npm config set registry https://registry.npmjs.org
|
# Update .npmrc for npmjs.org
|
||||||
npm config set //registry.npmjs.org/:_authToken "$NPMCI_TOKEN_NPM"
|
echo "registry=https://registry.npmjs.org/" > .npmrc
|
||||||
|
echo "//registry.npmjs.org/:_authToken=${NPMCI_TOKEN_NPM}" >> .npmrc
|
||||||
pnpm publish --no-git-checks
|
pnpm publish --no-git-checks
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-10-26 - 4.3.6 - fix(ci)
|
||||||
|
Use .npmrc for registry authentication in Gitea workflow and add conditional npmjs publish
|
||||||
|
|
||||||
|
- Replace npm config set commands with creating a .npmrc file for Gitea registry authentication in .gitea/workflows/default_tags.yaml
|
||||||
|
- Add conditional update of .npmrc and publishing to npmjs.org when NPMCI_TOKEN_NPM is provided
|
||||||
|
- Keep pnpm publish --no-git-checks; improve CI credential handling to be file-based
|
||||||
|
|
||||||
## 2025-10-26 - 4.3.5 - fix(workflows)
|
## 2025-10-26 - 4.3.5 - fix(workflows)
|
||||||
Remove npmci wrappers from CI workflows and use pnpm/npm CLI directly
|
Remove npmci wrappers from CI workflows and use pnpm/npm CLI directly
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartrequest',
|
name: '@push.rocks/smartrequest',
|
||||||
version: '4.3.5',
|
version: '4.3.6',
|
||||||
description: 'A module for modern HTTP/HTTPS requests with support for form data, file uploads, JSON, binary data, streams, and more.'
|
description: 'A module for modern HTTP/HTTPS requests with support for form data, file uploads, JSON, binary data, streams, and more.'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user