fix(ci): Improve Gitea release workflow: install deps, configure Gitea npm registry, and optionally publish to npmjs.org

This commit is contained in:
2025-10-25 17:09:33 +00:00
parent 7d3c94cae6
commit d141ceeaf7
3 changed files with 23 additions and 1 deletions

View File

@@ -88,7 +88,20 @@ jobs:
- name: Release
run: |
npmci node install stable
npmci npm install
# Extract server host from GITHUB_SERVER_URL (remove https://)
GITEA_HOST="${GITHUB_SERVER_URL#https://}"
GITEA_REGISTRY="$GITHUB_SERVER_URL/api/packages/$GITHUB_REPOSITORY_OWNER/npm/"
# Configure Gitea npm registry
npmci command npm config set @${GITHUB_REPOSITORY_OWNER}:registry "$GITEA_REGISTRY"
npmci command npm config set "//${GITEA_HOST}/api/packages/${GITHUB_REPOSITORY_OWNER}/npm/:_authToken" "$GITEA_TOKEN"
# Publish to Gitea
npmci npm publish
# Conditionally publish to npmjs.org if token exists
if [ -n "$NPMCI_TOKEN_NPM" ]; then
npmci command npm config set registry https://registry.npmjs.org
npmci npm publish
fi
metadata:
needs: test