fix(ci): corrected variable names and removed test
Some checks failed
CI / build-and-publish (push) Failing after 1m12s
Some checks failed
CI / build-and-publish (push) Failing after 1m12s
This commit is contained in:
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Checkout repository
|
||||
env:
|
||||
ALPINE_MIRROR: ${{ secrets.ALPINE_MIRROR }}
|
||||
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||
G_TOKEN: ${{ secrets.G_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d'.' -f1-2) && \
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
|
||||
HOST="${GITHUB_SERVER_URL#https://}"
|
||||
REPO="${{ github.repository }}"
|
||||
AUTH_URL="https://${GITEA_TOKEN}@${HOST}/${REPO}.git"
|
||||
AUTH_URL="https://${G_TOKEN}@${HOST}/${REPO}.git"
|
||||
|
||||
git clone --depth 1 --branch "$GITHUB_REF_NAME" "$AUTH_URL" .
|
||||
|
||||
@@ -56,34 +56,14 @@ jobs:
|
||||
- name: Publish to Gitea npm registry
|
||||
if: success()
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||
G_TOKEN: ${{ secrets.G_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
# Debug: verify token exists
|
||||
if [ -z "$GITEA_TOKEN" ]; then
|
||||
echo "ERROR: GITEA_TOKEN is empty!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove any locally-committed .npmrc to avoid conflicts
|
||||
rm -f .npmrc
|
||||
|
||||
HOST="${GITHUB_SERVER_URL#https://}"
|
||||
OWNER="${GITHUB_REPOSITORY_OWNER}"
|
||||
|
||||
# Build registry URL without trailing slash
|
||||
REGISTRY="https://${HOST}/api/packages/${OWNER}/npm"
|
||||
|
||||
# Auth key MUST exactly match the registry path (also without trailing slash)
|
||||
AUTH_KEY="//${HOST}/api/packages/${OWNER}/npm/:_authToken"
|
||||
npm config set "//${HOST}/api/packages/${OWNER}/npm/:_authToken" "${G_TOKEN}"
|
||||
npm config set registry "${REGISTRY}"
|
||||
|
||||
npm config set "$AUTH_KEY" "${GITEA_TOKEN}"
|
||||
npm config set registry "$REGISTRY"
|
||||
|
||||
# Double-check the effective config
|
||||
echo "Effective registry: $(npm config get registry)"
|
||||
echo "Token for ${HOST} is set: $(npm config get "$AUTH_KEY")"
|
||||
|
||||
# Publish without --registry (uses the global config we just set)
|
||||
npm publish --ignore-scripts
|
||||
|
||||
Reference in New Issue
Block a user