Skip to content

Fastest way to scaffold your LLM powered personal knowledge base - Obsidian, Claude Code, qmd, Github

make ci pipeline more robust

jessepinkman99001d02179428ea
diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml
index e12c08e..50aec55 100644
--- a/.github/workflows/release-publish.yml
+++ b/.github/workflows/release-publish.yml
@@ -4,6 +4,7 @@ on:
push:
branches:
- main
+ workflow_dispatch:
permissions:
contents: write
@@ -26,8 +27,8 @@ jobs:
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
- - name: Check if release already exists
- id: check
+ - name: Check if GitHub release already exists
+ id: check_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@@ -37,15 +38,51 @@ jobs:
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
+ - name: Check if npm version already exists
+ id: check_npm
+ run: |
+ PACKAGE_NAME=$(jq -r '.name' package.json)
+ VERSION="${{ steps.version.outputs.version }}"
+ PUBLISHED=$(npm view "${PACKAGE_NAME}@${VERSION}" version 2>/dev/null || true)
+ if [ -n "$PUBLISHED" ]; then
+ echo "exists=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "exists=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Write check results to summary
+ run: |
+ VERSION="${{ steps.version.outputs.version }}"
+ TAG="${{ steps.version.outputs.tag }}"
+ GH_EXISTS="${{ steps.check_release.outputs.exists }}"
+ NPM_EXISTS="${{ steps.check_npm.outputs.exists }}"
+
+ echo "## Release Checks for \`${TAG}\`" >> "$GITHUB_STEP_SUMMARY"
+ echo "" >> "$GITHUB_STEP_SUMMARY"
+ echo "| Check | Status |" >> "$GITHUB_STEP_SUMMARY"
+ echo "|-------|--------|" >> "$GITHUB_STEP_SUMMARY"
+
+ if [ "$GH_EXISTS" = "true" ]; then
+ echo "| GitHub Release \`${TAG}\` | ⚠️ Already exists — skipping release creation |" >> "$GITHUB_STEP_SUMMARY"
+ else
+ echo "| GitHub Release \`${TAG}\` | ✅ Not found — will create |" >> "$GITHUB_STEP_SUMMARY"
+ fi
+
+ if [ "$NPM_EXISTS" = "true" ]; then
+ echo "| npm \`${VERSION}\` | ⚠️ Already published — skipping npm publish |" >> "$GITHUB_STEP_SUMMARY"
+ else
+ echo "| npm \`${VERSION}\` | ✅ Not found — will publish |" >> "$GITHUB_STEP_SUMMARY"
+ fi
+
- name: Set up Node.js with npm registry auth
- if: steps.check.outputs.exists == 'false'
+ if: steps.check_npm.outputs.exists == 'false'
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Create tag and release
- if: steps.check.outputs.exists == 'false'
+ if: steps.check_release.outputs.exists == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@@ -55,7 +92,7 @@ jobs:
--latest
- name: Publish to npm
- if: steps.check.outputs.exists == 'false'
+ if: steps.check_npm.outputs.exists == 'false'
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}