fix(ci): Improve Gitea release workflow: install deps, configure Gitea npm registry, and optionally publish to npmjs.org
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user