Update README.md formatting and content structure #30
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: Publish @kiliczsh/mcp-mongo-server | |
on: | |
release: | |
types: [created] | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
publish-gpr: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
env: | |
STATIC_VERSION: "1.2.0" | |
BUILD_ID: ${{ github.run_number }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://npm.pkg.github.com/ | |
- name: Copy GitHub NPM configuration | |
run: cp .npmrc-github .npmrc | |
- name: Determine Version | |
run: | | |
if [[ "${{ github.event_name }}" == "release" ]]; then | |
VERSION="${{ github.event.release.tag_name }}" | |
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | |
VERSION="${STATIC_VERSION}-main.${BUILD_ID}" | |
else | |
VERSION="${STATIC_VERSION}-build.${BUILD_ID}" | |
fi | |
echo "Using version: $VERSION" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Create Git Tag | |
if: github.event_name != 'release' | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git tag -a "$VERSION" -m "Version $VERSION" | |
git push https://${{ secrets.NODE_AUTH_TOKEN }}@github.com/kiliczsh/mcp-mongo-server.git "$VERSION" | |
- name: Update package.json version and publishConfig | |
run: | | |
sed -i 's/"name": "mcp-mongo-server"/"name": "@kiliczsh\/mcp-mongo-server"/' package.json | |
jq --arg version "$VERSION" '.version = $version' package.json > package.tmp.json && mv package.tmp.json package.json | |
echo '{ | |
"access": "public", | |
"registry": "https://npm.pkg.github.com" | |
}' > publishConfig.json | |
jq -s '.[0] * {publishConfig: .[1]}' package.json publishConfig.json > package.tmp.json && mv package.tmp.json package.json | |
- name: Install dependencies | |
run: npm ci | |
- name: Publish package to GitHub Packages | |
run: npm publish --registry=https://npm.pkg.github.com | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} |