Skip to main content
Glama
release.ymlβ€’14.7 kB
name: πŸš€ Release & Publish # NOTE: This workflow requires a RELEASE_TOKEN secret to bypass branch protection rules # The token needs the following permissions: # - repo (full control) # - workflow # - write:packages (for npm publishing) # Without RELEASE_TOKEN, the workflow will fail if branch protection rules are enabled on: push: branches: [main] release: types: [published] env: NODE_VERSION: "20" HUSKY: 0 CI: true jobs: # 🏷️ Semantic Release semantic-release: name: 🏷️ Semantic Release runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/main' permissions: contents: write issues: write pull-requests: write outputs: new-release-published: ${{ steps.semantic.outputs.new-release-published }} new-release-version: ${{ steps.semantic.outputs.new-release-version }} steps: - name: πŸ“₯ Checkout Code uses: actions/checkout@v4 with: fetch-depth: 0 # Use RELEASE_TOKEN if available for bypassing branch protection rules # Falls back to GITHUB_TOKEN if RELEASE_TOKEN is not set token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }} - name: πŸ“¦ Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: "npm" - name: πŸ“¦ Install Dependencies run: npm ci env: HUSKY: 0 - name: πŸ—οΈ Build Project run: npm run build env: HUSKY: 0 - name: πŸ§ͺ Run Essential Tests run: | # Run core tests that must pass for release npm run test:ci || npm run test:typescript env: WORDPRESS_SITE_URL: https://example.com WORDPRESS_USERNAME: test_user WORDPRESS_APP_PASSWORD: test_password CI: true HUSKY: 0 - name: 🏷️ Semantic Release id: semantic uses: cycjimmy/semantic-release-action@v4 with: semantic_version: 24 extra_plugins: | @semantic-release/changelog@6.0.3 @semantic-release/git@10.0.1 env: # Use RELEASE_TOKEN if available for bypassing branch protection rules GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} HUSKY: 0 NODE_OPTIONS: "--max-old-space-size=4096" # πŸ“¦ NPM Publish npm-publish: name: πŸ“¦ Fallback NPM Publish runs-on: ubuntu-latest needs: semantic-release if: failure() && github.event_name == 'release' permissions: contents: read id-token: write steps: - name: πŸ“₯ Checkout Code uses: actions/checkout@v4 - name: πŸ“¦ Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: "npm" registry-url: "https://registry.npmjs.org" - name: πŸ“¦ Install Dependencies run: npm ci env: HUSKY: 0 - name: πŸ—οΈ Build Project run: npm run build env: HUSKY: 0 - name: πŸ§ͺ Verify Build run: | npm run typecheck npm run lint npm pack --dry-run env: HUSKY: 0 - name: πŸ” Check Ignore Files run: npm run check:ignore - name: πŸ“¦ Publish to NPM run: npm publish --provenance env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} HUSKY: 0 # 🐳 Docker Publish docker-publish: name: 🐳 Publish to Docker Hub runs-on: ubuntu-latest needs: semantic-release if: needs.semantic-release.outputs.new-release-published == 'true' || github.event_name == 'release' permissions: contents: read packages: write steps: - name: πŸ“₯ Checkout Code uses: actions/checkout@v4 - name: 🐳 Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: πŸ” Log in to Docker Hub uses: docker/login-action@v3 with: registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: πŸ” Verify Docker Login run: | echo "Verifying Docker Hub login..." docker info echo "Docker Hub login successful" - name: πŸ” Debug Release Info run: | echo "Release info debug:" echo "New release published: ${{ needs.semantic-release.outputs.new-release-published }}" echo "New release version: ${{ needs.semantic-release.outputs.new-release-version }}" echo "GitHub ref: ${{ github.ref }}" echo "GitHub ref name: ${{ github.ref_name }}" echo "Event name: ${{ github.event_name }}" echo "Is tag: ${{ startsWith(github.ref, 'refs/tags/') }}" echo "Current working directory:" pwd echo "Git status:" git status || true echo "Git tags:" git tag --sort=-version:refname | head -5 || true - name: πŸ“ Extract Metadata id: meta uses: docker/metadata-action@v5 with: images: docker.io/docdyhr/mcp-wordpress tags: | type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }} type=semver,pattern={{major}},enable=${{ github.event_name == 'release' }} type=raw,value=${{ needs.semantic-release.outputs.new-release-version }},enable=${{ needs.semantic-release.outputs.new-release-published == 'true' }} type=raw,value=latest,enable={{is_default_branch}} labels: | org.opencontainers.image.title=MCP WordPress Server org.opencontainers.image.description=Complete WordPress MCP Server with 59 management tools, intelligent caching, and real-time monitoring org.opencontainers.image.version=${{ needs.semantic-release.outputs.new-release-version || github.ref_name }} org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.created={{date 'YYYY-MM-DDTHH:mm:ssZ'}} org.opencontainers.image.source=https://github.com/docdyhr/mcp-wordpress org.opencontainers.image.url=https://github.com/docdyhr/mcp-wordpress org.opencontainers.image.documentation=https://github.com/docdyhr/mcp-wordpress#readme org.opencontainers.image.licenses=MIT - name: πŸ” Debug Extracted Tags run: | echo "Extracted tags:" echo "${{ steps.meta.outputs.tags }}" echo "" echo "Extracted labels:" echo "${{ steps.meta.outputs.labels }}" echo "" echo "Metadata JSON:" echo "${{ steps.meta.outputs.json }}" - name: πŸ—οΈ Build and Push Docker Image id: docker-build uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max build-args: | VERSION=${{ needs.semantic-release.outputs.new-release-version || github.ref_name }} BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VCS_REF=${{ github.sha }} # v6 features provenance: true sbom: true - name: πŸ”„ Retry Docker Build on Failure if: failure() && steps.docker-build.outcome == 'failure' uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max build-args: | VERSION=${{ needs.semantic-release.outputs.new-release-version || github.ref_name }} BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VCS_REF=${{ github.sha }} provenance: true sbom: true - name: πŸ“ Update Docker Hub Description uses: peter-evans/dockerhub-description@v3 if: github.event_name == 'release' || needs.semantic-release.outputs.new-release-published == 'true' || github.ref == 'refs/heads/main' with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: docdyhr/mcp-wordpress readme-filepath: ./README.md - name: 🎯 Verify Docker Push Success id: verify-docker run: | echo "Docker build and push completed successfully" echo "Published tags:" echo "${{ steps.meta.outputs.tags }}" echo "" echo "Version: ${{ needs.semantic-release.outputs.new-release-version || github.ref_name }}" # Wait for Docker Hub propagation echo "Waiting for Docker Hub propagation..." sleep 30 # Verify the image was pushed successfully VERSION="${{ needs.semantic-release.outputs.new-release-version || github.ref_name }}" echo "Verifying Docker Hub publishing for version: $VERSION" # Try to pull the image to verify it exists if docker pull docdyhr/mcp-wordpress:$VERSION; then echo "βœ… Successfully verified Docker image on Docker Hub" echo "verification_status=success" >> $GITHUB_OUTPUT else echo "❌ Failed to verify Docker image on Docker Hub" echo "verification_status=failure" >> $GITHUB_OUTPUT exit 1 fi - name: 🚨 Docker Verification Failed - Create Alert if: failure() && steps.verify-docker.outputs.verification_status == 'failure' run: | echo "::error title=Docker Publishing Verification Failed::Failed to verify Docker image publication" echo "Manual intervention may be required to publish the Docker image" # πŸ“¦ DXT Package Build and Upload dxt-package: name: πŸ“¦ Build and Upload DXT Package runs-on: ubuntu-latest needs: [semantic-release] if: | always() && ( (needs.semantic-release.result == 'success' && needs.semantic-release.outputs.new-release-published == 'true') || github.event_name == 'release' ) permissions: contents: write steps: - name: πŸ“₯ Checkout Code uses: actions/checkout@v4 with: fetch-depth: 0 - name: πŸ“¦ Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: "npm" - name: πŸ“¦ Install Dependencies run: npm ci env: HUSKY: 0 - name: πŸ—οΈ Build Project run: npm run build env: HUSKY: 0 - name: πŸ“¦ Install DXT CLI run: npm install -g @anthropic-ai/dxt env: HUSKY: 0 - name: 🎁 Build DXT Package run: npm run dxt:package:official env: HUSKY: 0 - name: πŸ” Verify DXT Package run: | ls -la mcp-wordpress.dxt echo "DXT package size: $(du -h mcp-wordpress.dxt | cut -f1)" file mcp-wordpress.dxt - name: 🏷️ Get Release Info id: release-info run: | if [ "${{ github.event_name }}" == "release" ]; then echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT else echo "version=${{ needs.semantic-release.outputs.new-release-version }}" >> $GITHUB_OUTPUT echo "tag=v${{ needs.semantic-release.outputs.new-release-version }}" >> $GITHUB_OUTPUT fi - name: πŸ“€ Upload DXT Package to Release uses: softprops/action-gh-release@v1 with: tag_name: ${{ steps.release-info.outputs.tag }} files: mcp-wordpress.dxt token: ${{ secrets.GITHUB_TOKEN }} - name: βœ… DXT Package Upload Success run: | echo "βœ… DXT package uploaded successfully!" echo "πŸ“¦ Package: mcp-wordpress.dxt" echo "🏷️ Version: ${{ steps.release-info.outputs.version }}" echo "πŸ”— Download URL: https://github.com/docdyhr/mcp-wordpress/releases/download/${{ steps.release-info.outputs.tag }}/mcp-wordpress.dxt" # πŸŽ‰ Post-Release Actions post-release: name: πŸŽ‰ Post-Release Actions runs-on: ubuntu-latest needs: [semantic-release, npm-publish, docker-publish, dxt-package] if: | always() && ( (needs.semantic-release.result == 'success' && needs.semantic-release.outputs.new-release-published == 'true') || github.event_name == 'release' ) steps: - name: πŸ“Š Release Summary run: | echo "πŸŽ‰ Release Pipeline Summary" echo "==========================" echo "🏷️ Version: ${{ needs.semantic-release.outputs.new-release-version || github.ref_name }}" echo "πŸ“¦ NPM Status: ${{ needs.npm-publish.result }}" echo "🐳 Docker Status: ${{ needs.docker-publish.result }}" echo "πŸ“¦ DXT Package Status: ${{ needs.dxt-package.result }}" echo "πŸ”„ Semantic Release: ${{ needs.semantic-release.result }}" echo "==========================" - name: βœ… Success Notification if: needs.semantic-release.result == 'success' && needs.docker-publish.result == 'success' && needs.dxt-package.result == 'success' run: | echo "πŸŽ‰ Release completed successfully!" echo "βœ… All components published successfully" echo "πŸ“¦ NPM: Published" echo "🐳 Docker: Published" echo "πŸ“¦ DXT Package: Uploaded" - name: 🚨 Failure Notification if: needs.semantic-release.result == 'failure' || needs.docker-publish.result == 'failure' || needs.dxt-package.result == 'failure' run: | echo "❌ Release had failures!" echo "Please check the workflow logs and fix any issues." echo "Semantic Release: ${{ needs.semantic-release.result }}" echo "Docker Publish: ${{ needs.docker-publish.result }}" echo "DXT Package: ${{ needs.dxt-package.result }}" exit 1

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/docdyhr/mcp-wordpress'

If you have feedback or need assistance with the MCP directory API, please join our Discord server