ci: use nexus credentials instead of pre-encoded auth

This commit is contained in:
Timi
2026-11-06 15:48:24 +08:00
parent e69e476ffc
commit 6b8abc32b1
+9 -6
View File
@@ -13,8 +13,6 @@ jobs:
release:
runs-on: act_runner_node
if: ${{ github.event.pull_request.merged == true }}
env:
NEXUS_AUTH: ${{ secrets.NEXUS_AUTH }}
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -39,17 +37,22 @@ jobs:
fi
- name: Configure nexus auth
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
if [ -z "$NEXUS_AUTH" ]; then
echo "FAIL: 缺少 secrets.NEXUS_AUTH"
if [ -z "$NEXUS_USERNAME" ] || [ -z "$NEXUS_PASSWORD" ]; then
echo "FAIL: 缺少 secrets.NEXUS_USERNAME 或 secrets.NEXUS_PASSWORD"
exit 1
fi
auth=$(printf '%s:%s' "$NEXUS_USERNAME" "$NEXUS_PASSWORD" | base64 | tr -d '\n')
{
echo "//nexus.imyeyu.com/repository/npm-group/:_auth=${NEXUS_AUTH}"
echo "//nexus.imyeyu.com/repository/npm-group/:_auth=${auth}"
echo "//nexus.imyeyu.com/repository/npm-group/:always-auth=true"
echo "//nexus.imyeyu.com/repository/npm-timi/:_auth=${NEXUS_AUTH}"
echo "//nexus.imyeyu.com/repository/npm-timi/:_auth=${auth}"
echo "//nexus.imyeyu.com/repository/npm-timi/:always-auth=true"
} > ~/.npmrc
echo "OK: nexus 认证已配置"
- name: Install dependencies
run: pnpm install --frozen-lockfile