fix(ci): corrected variable names and removed test
Some checks failed
CI / build-and-publish (push) Failing after 1m12s

This commit is contained in:
2026-05-12 11:29:46 +03:30
parent 2ead714719
commit 0c31a6b0c0

View File

@@ -16,7 +16,7 @@ jobs:
- name: Checkout repository - name: Checkout repository
env: env:
ALPINE_MIRROR: ${{ secrets.ALPINE_MIRROR }} ALPINE_MIRROR: ${{ secrets.ALPINE_MIRROR }}
GITEA_TOKEN: ${{ secrets.G_TOKEN }} G_TOKEN: ${{ secrets.G_TOKEN }}
run: | run: |
set -e set -e
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d'.' -f1-2) && \ ALPINE_VERSION=$(cat /etc/alpine-release | cut -d'.' -f1-2) && \
@@ -27,7 +27,7 @@ jobs:
HOST="${GITHUB_SERVER_URL#https://}" HOST="${GITHUB_SERVER_URL#https://}"
REPO="${{ github.repository }}" 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" . git clone --depth 1 --branch "$GITHUB_REF_NAME" "$AUTH_URL" .
@@ -56,34 +56,14 @@ jobs:
- name: Publish to Gitea npm registry - name: Publish to Gitea npm registry
if: success() if: success()
env: env:
GITEA_TOKEN: ${{ secrets.G_TOKEN }} G_TOKEN: ${{ secrets.G_TOKEN }}
run: | run: |
set -e 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://}" HOST="${GITHUB_SERVER_URL#https://}"
OWNER="${GITHUB_REPOSITORY_OWNER}" OWNER="${GITHUB_REPOSITORY_OWNER}"
# Build registry URL without trailing slash
REGISTRY="https://${HOST}/api/packages/${OWNER}/npm" REGISTRY="https://${HOST}/api/packages/${OWNER}/npm"
# Auth key MUST exactly match the registry path (also without trailing slash) npm config set "//${HOST}/api/packages/${OWNER}/npm/:_authToken" "${G_TOKEN}"
AUTH_KEY="//${HOST}/api/packages/${OWNER}/npm/:_authToken" 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 npm publish --ignore-scripts