chore(version): bump version v0.3.4 #101
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
| # .github/workflows/docker-publish.yml | |
| name: Build and Publish Docker Image to GHCR | |
| on: | |
| push: | |
| branches: | |
| - main # Trigger on push to main branch | |
| workflow_dispatch: # Allows manual triggering | |
| permissions: | |
| contents: read # Needed to check out code, read package.json, and read release info | |
| packages: write # Needed to push Docker image to GHCR | |
| jobs: | |
| build-and-publish: | |
| name: Build and Publish Docker Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' # Or the Node.js version used by your project | |
| - name: Extract version from package.json | |
| id: get_version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Compare package version with latest release tag | |
| id: compare_versions | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const packageVersion = "${{ steps.get_version.outputs.version }}"; | |
| console.log(`Package version: ${packageVersion}`); | |
| if (context.eventName === 'workflow_dispatch') { | |
| console.log('Manual trigger detected. Skipping version check and forcing build.'); | |
| core.setOutput('needs_build', 'true'); | |
| } else { | |
| console.log('Push trigger detected. Comparing package version with latest release tag.'); | |
| try { | |
| const latestRelease = await github.rest.repos.getLatestRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| const latestTag = latestRelease.data.tag_name; | |
| console.log(`Latest release tag: ${latestTag}`); | |
| // Assuming tag is like 'v1.2.3', remove 'v' prefix | |
| const latestVersion = latestTag.startsWith('v') ? latestTag.substring(1) : latestTag; | |
| console.log(`Latest release version: ${latestVersion}`); | |
| if (packageVersion !== latestVersion) { | |
| console.log('Version mismatch. Build needed.'); | |
| core.setOutput('needs_build', 'true'); | |
| } else { | |
| console.log('Versions match. No build needed.'); | |
| core.setOutput('needs_build', 'false'); | |
| } | |
| } catch (error) { | |
| // Handle case where no releases exist yet or API error | |
| if (error.status === 404) { | |
| console.log('No releases found. Build needed.'); | |
| core.setOutput('needs_build', 'true'); | |
| } else { | |
| console.error('Error fetching latest release:', error); | |
| core.setFailed(`Error fetching latest release: ${error.message}`); | |
| core.setOutput('needs_build', 'false'); // Don't build on error | |
| } | |
| } | |
| } | |
| - name: Log in to GitHub Container Registry | |
| if: steps.compare_versions.outputs.needs_build == 'true' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| if: steps.compare_versions.outputs.needs_build == 'true' | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Append ENTRYPOINT and CMD to Dockerfile for standalone build | |
| if: steps.compare_versions.outputs.needs_build == 'true' | |
| run: | | |
| echo '' >> Dockerfile # Add a newline for separation | |
| echo '# Added by GitHub Actions for standalone build' >> Dockerfile | |
| echo 'ENTRYPOINT ["tini", "--"]' >> Dockerfile | |
| echo 'CMD ["node", "build/sse.js"]' >> Dockerfile | |
| echo 'Dockerfile content after append:' | |
| cat Dockerfile | |
| - name: Build and push standard Docker image | |
| if: steps.compare_versions.outputs.needs_build == 'true' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/aarch64 | |
| # Dockerfile already modified by "Append ENTRYPOINT..." step for standalone | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/mcp-proxy-server:${{ steps.get_version.outputs.version }} | |
| ghcr.io/${{ github.repository }}/mcp-proxy-server:latest | |
| # build-args will use the default empty ARGs from Dockerfile for a lean image | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build and push bundled Docker image | |
| if: steps.compare_versions.outputs.needs_build == 'true' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/aarch64 | |
| # Dockerfile already modified by "Append ENTRYPOINT..." step for standalone | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/mcp-proxy-server:${{ steps.get_version.outputs.version }}-bundled-mcpservers-playwright | |
| ghcr.io/${{ github.repository }}/mcp-proxy-server:latest-bundled-mcpservers-playwright | |
| build-args: | | |
| PRE_INSTALLED_PIP_PACKAGES_ARG=markitdown-mcp mcp-proxy | |
| PRE_INSTALLED_NPM_PACKAGES_ARG=g-search-mcp fetcher-mcp playwright time-mcp mcp-trends-hub @adenot/mcp-google-search edgeone-pages-mcp @modelcontextprotocol/server-filesystem mcp-server-weibo @variflight-ai/variflight-mcp @baidumap/mcp-server-baidu-map @modelcontextprotocol/inspector | |
| PRE_INSTALLED_INIT_COMMAND_ARG=playwright install --with-deps chromium | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |