name: Release and Publish
on:
push:
branches:
- main
workflow_dispatch:
jobs:
release-and-publish:
# Run for release-triggering commits, including in merge commits
if: |
github.event_name == 'workflow_dispatch' ||
contains(toJSON(github.event.commits.*.message), 'feat:') ||
contains(toJSON(github.event.commits.*.message), 'feat!:') ||
contains(toJSON(github.event.commits.*.message), 'fix:') ||
contains(toJSON(github.event.commits.*.message), 'perf:') ||
contains(toJSON(github.event.commits.*.message), 'BREAKING CHANGE')
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
issues: write
pull-requests: 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: "lts/*"
registry-url: "https://registry.npmjs.org"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config pull.rebase false
- name: Build project
run: bun run build
- name: Run semantic-release
id: semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: packages/mcp-server
run: npx semantic-release