nile-mcp
Official
by niledatabase
- .github
- workflows
name: Publish MCP Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{secrets.PAT}}
- name: Enable Corepack before setting up Node
run: corepack enable
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Authenticate to npm
run: |
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Run tests
run: yarn test
- name: Version and Publish
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Configure both npm and GitHub Package registries
echo "registry=https://registry.npmjs.org/" > .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
# Run semantic-release
npx semantic-release
- name: Increment Alpha Version
if: success()
run: |
# Configure git
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
# Get the current version from main
MAIN_VERSION=$(node -p "require('./package.json').version")
# Checkout alpha branch
git fetch origin alpha
git checkout alpha
# Install dependencies to ensure package-lock.json is present
npm install
# Increment minor version and add alpha suffix
MAJOR_MINOR=$(echo $MAIN_VERSION | cut -d. -f1,2)
PATCH=$(echo $MAIN_VERSION | cut -d. -f3)
NEW_MINOR=$(($(echo $MAJOR_MINOR | cut -d. -f2) + 1))
NEW_VERSION="$(echo $MAJOR_MINOR | cut -d. -f1).$NEW_MINOR.0-alpha.1"
# Update package.json and package-lock.json with new version
npm version $NEW_VERSION --no-git-tag-version
# Commit and push changes
git add package.json package-lock.json
git commit -m "chore: bump version to $NEW_VERSION for future alpha releases [skip ci]"
git push origin alpha
git push origin alpha