chore: debug release script (#1348) #771
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
permissions: {} | |
jobs: | |
release: | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v5 | |
with: | |
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
fetch-depth: 0 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 24 | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Debug | |
continue-on-error: true | |
run: | | |
set -euxo pipefail | |
echo "Node/npm/pnpm versions:" | |
node -v | |
npm -v | |
pnpm -v | |
echo "\nCurrent npm registry:" | |
npm config get registry || true | |
echo "\nSanitized npm config (full):" | |
npm config list -l | sed -E 's/(\/\/registry\.npmjs\.org\/:_authToken=).*/\1[REDACTED]/' || true | |
echo "\nSanitized ~/.npmrc:" | |
if [ -f "$HOME/.npmrc" ]; then sed -E 's/(\/\/registry\.npmjs\.org\/:_authToken=).*/\1[REDACTED]/' "$HOME/.npmrc"; else echo "No ~/.npmrc"; fi | |
echo "\nSanitized project .npmrc:" | |
if [ -f ".npmrc" ]; then sed -E 's/(\/\/registry\.npmjs\.org\/:_authToken=).*/\1[REDACTED]/' ".npmrc"; else echo "No project .npmrc"; fi | |
echo "\nRunning prerelease script (non-fatal):" | |
pnpm run prerelease || true | |
echo "\nRunning npm whoami with verbose logging (non-fatal):" | |
NPM_CONFIG_LOGLEVEL=silly npm whoami || true | |
echo "\nDry-run npm publish with verbose logging (non-fatal):" | |
NPM_CONFIG_LOGLEVEL=silly npm publish --dry-run || true | |
- name: Print latest npm debug log if present | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
LOG_DIR="/home/runner/.npm/_logs" | |
echo "Looking for npm logs in $LOG_DIR" | |
ls -al "$LOG_DIR" 2>/dev/null || echo "Log directory not found" | |
latest=$(ls -t "$LOG_DIR"/*.log 2>/dev/null | head -n 1 || true) | |
if [ -n "${latest:-}" ] && [ -f "$latest" ]; then | |
echo "\n=== Showing latest npm debug log: $latest ===" | |
# Redact any accidental token appearances | |
sed -E 's/(\/\/registry\.npmjs\.org\/:_authToken=)[^"\n]+/\1[REDACTED]/g' "$latest" || cat "$latest" | |
else | |
echo "No npm debug logs found" | |
fi | |
- name: Environment snapshot (sanitized) | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
echo "Relevant environment variables:" | |
env | sort | grep -E '^(CI=|GITHUB_|NODE_|NPM_|PNPM_)' || true | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`. | |
version: pnpm run version:ci | |
# This expects you to have a script called release which does a build for your packages and calls changeset publish | |
publish: pnpm run release | |
commit: 'chore: release eslint-plugin-svelte' | |
title: 'chore: release eslint-plugin-svelte' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_CONFIG_PROVENANCE: true |