Manifest-driven prompts and resources for MCP #19
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: Build and Release MCP Resources | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version number (e.g., 1.0.0)' | |
| required: false | |
| type: string | |
| jobs: | |
| build-and-release: | |
| # Manual trigger OR (PR merged with label 'mcp-publish') | |
| if: | | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event.pull_request.merged == true && | |
| contains(github.event.pull_request.labels.*.name, 'mcp-publish')) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for proper versioning | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| echo "Using manually specified version: ${VERSION}" | |
| else | |
| # Get the latest semver tag (ignore 'latest' tag), or use 0.0.0 if no tags exist | |
| # Use grep to filter only tags matching semver pattern (v followed by digits) | |
| # Explicitly exclude 'latest' tag | |
| LATEST_TAG=$(git tag -l | grep -v '^latest$' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1) | |
| if [ -z "$LATEST_TAG" ]; then | |
| LATEST_TAG="v0.0.0" | |
| fi | |
| echo "Latest semver tag found: ${LATEST_TAG}" | |
| # Remove 'v' prefix if present | |
| LATEST_VERSION=${LATEST_TAG#v} | |
| # Parse version components | |
| IFS='.' read -r -a VERSION_PARTS <<< "$LATEST_VERSION" | |
| MAJOR=${VERSION_PARTS[0]:-0} | |
| MINOR=${VERSION_PARTS[1]:-0} | |
| PATCH=${VERSION_PARTS[2]:-0} | |
| # Determine bump type from PR labels | |
| BUMP_TYPE="patch" # Default to patch | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| PR_LABELS="${{ join(github.event.pull_request.labels.*.name, ',') }}" | |
| echo "PR Labels: ${PR_LABELS}" | |
| if echo "${PR_LABELS}" | grep -q "major"; then | |
| BUMP_TYPE="major" | |
| elif echo "${PR_LABELS}" | grep -q "minor"; then | |
| BUMP_TYPE="minor" | |
| elif echo "${PR_LABELS}" | grep -q "patch"; then | |
| BUMP_TYPE="patch" | |
| fi | |
| fi | |
| echo "Bump type: ${BUMP_TYPE}" | |
| # Increment version based on bump type | |
| case "${BUMP_TYPE}" in | |
| major) | |
| MAJOR=$((MAJOR + 1)) | |
| MINOR=0 | |
| PATCH=0 | |
| ;; | |
| minor) | |
| MINOR=$((MINOR + 1)) | |
| PATCH=0 | |
| ;; | |
| patch) | |
| PATCH=$((PATCH + 1)) | |
| ;; | |
| esac | |
| VERSION="${MAJOR}.${MINOR}.${PATCH}" | |
| echo "Bumping from ${LATEST_VERSION} to ${VERSION} (${BUMP_TYPE})" | |
| fi | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "tag=v${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Building version: ${VERSION}" | |
| - name: Build markdown documentation | |
| run: npm run build:docs | |
| env: | |
| BUILD_VERSION: ${{ steps.version.outputs.version }} | |
| - name: List build artifacts | |
| run: ls -lh dist/ | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| release_name: Release ${{ steps.version.outputs.tag }} | |
| body: | | |
| Automated release of PostHog example projects and LLM prompts as markdown documentation. | |
| This release contains **examples-mcp-resources.zip** with: | |
| - Pre-processed markdown files for all example projects | |
| - LLM workflow guide prompts (in `prompts/` directory) | |
| **Version:** ${{ steps.version.outputs.version }} | |
| **SHA:** ${{ github.sha }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./dist/examples-mcp-resources.zip | |
| asset_name: examples-mcp-resources.zip | |
| asset_content_type: application/zip | |
| - name: Update latest tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Create the version tag locally first | |
| git tag ${{ steps.version.outputs.tag }} | |
| # Point latest to the current commit (same as the version tag) | |
| git tag -f latest | |
| # Push both tags | |
| git push origin ${{ steps.version.outputs.tag }} | |
| git push -f origin latest | |
| - name: Build Summary | |
| run: | | |
| echo "## Release Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Tag:** ${{ steps.version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Artifact:** examples-mcp-resources.zip" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Manifest Metadata" >> $GITHUB_STEP_SUMMARY | |
| echo '```json' >> $GITHUB_STEP_SUMMARY | |
| cat dist/manifest.json | jq '{version, buildVersion, buildTimestamp}' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Files Generated" >> $GITHUB_STEP_SUMMARY | |
| ls -lh dist/ >> $GITHUB_STEP_SUMMARY |