Files
obsidian-mcp-server/.github/workflows/release.yml
Bill cc4e71f920 refactor: remove 'obsidian' from plugin ID and update branding
- Change plugin ID from 'obsidian-mcp-server' to 'mcp-server'
- Remove 'Obsidian' from plugin description per guidelines
- Update documentation to use new plugin folder name
- Update installation paths to .obsidian/plugins/mcp-server/
- Update package name to match new plugin ID
- Simplify README title and description
2025-10-26 16:47:36 -04:00

153 lines
4.8 KiB
YAML

name: Release Plugin
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate version consistency
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/}"
PKG_VERSION=$(node -p "require('./package.json').version")
MANIFEST_VERSION=$(node -p "require('./manifest.json').version")
echo "Checking version consistency..."
echo "Git tag: $TAG_VERSION"
echo "package.json: $PKG_VERSION"
echo "manifest.json: $MANIFEST_VERSION"
if [ "$TAG_VERSION" != "$PKG_VERSION" ] || [ "$TAG_VERSION" != "$MANIFEST_VERSION" ]; then
echo "❌ Version mismatch detected!"
echo "Git tag: $TAG_VERSION"
echo "package.json: $PKG_VERSION"
echo "manifest.json: $MANIFEST_VERSION"
exit 1
fi
echo "✅ All versions match: $TAG_VERSION"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build plugin
run: npm run build
- name: Verify build artifacts
run: |
echo "Verifying required files exist..."
if [ ! -f main.js ]; then
echo "❌ main.js not found!"
exit 1
fi
if [ ! -f manifest.json ]; then
echo "❌ manifest.json not found!"
exit 1
fi
if [ ! -f styles.css ]; then
echo "❌ styles.css not found!"
exit 1
fi
echo "✅ All required files present"
echo "File sizes:"
ls -lh main.js manifest.json styles.css
- name: Create draft release (GitHub)
if: github.server_url == 'https://github.com'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/}"
gh release create "$TAG_VERSION" \
--title="$TAG_VERSION" \
--draft \
--notes="$(cat <<'EOF'
Release $TAG_VERSION
## Changes
*Add release notes here before publishing*
## Installation
1. Download main.js, manifest.json, and styles.css
2. Create a folder in .obsidian/plugins/obsidian-mcp-server/
3. Copy the three files into the folder
4. Reload Obsidian
5. Enable the plugin in Settings → Community Plugins
EOF
)" \
main.js \
manifest.json \
styles.css
echo "✅ Draft release created: $TAG_VERSION"
echo "Visit https://github.com/${{ github.repository }}/releases to review and publish"
- name: Create draft release (Gitea)
if: github.server_url != 'https://github.com'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/}"
# Create release via API
RESPONSE=$(curl -s -X POST \
-H "Accept: application/json" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" \
-d "$(cat <<EOF
{
"tag_name": "$TAG_VERSION",
"name": "$TAG_VERSION",
"body": "Release $TAG_VERSION\n\n## Changes\n\n*Add release notes here before publishing*\n\n## Installation\n\n1. Download main.js, manifest.json, and styles.css\n2. Create a folder in .obsidian/plugins/mcp-server/\n3. Copy the three files into the folder\n4. Reload Obsidian\n5. Enable the plugin in Settings → Community Plugins",
"draft": true,
"prerelease": false
}
EOF
)")
# Extract release ID using grep and sed (no jq dependency)
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
echo "Created release with ID: $RELEASE_ID"
# Upload release assets
for file in main.js manifest.json styles.css; do
echo "Uploading $file..."
curl -X POST \
-H "Accept: application/json" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$file" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets?name=$file"
done
echo "✅ Draft release created: $TAG_VERSION"
echo "Visit ${{ github.server_url }}/${{ github.repository }}/releases to review and publish"