basant307/AI_Governance_Project
048
1name: 'CD: mobile-mcp'2 3on:4 push:5 tags: ['mobile-mcp-v*']6 workflow_dispatch:7 inputs:8 version:9 description: 'Version to publish (without v prefix, e.g. 0.1.0)'10 required: true11 dry_run:12 description: 'Dry run (build only, no publish)'13 required: false14 type: 'boolean'15 default: true16 17jobs:18 build-and-publish:19 runs-on: 'ubuntu-latest'20 environment:21 name: 'production-release'22 permissions:23 contents: 'read'24 steps:25 - uses: 'actions/checkout@v4'26 27 - uses: 'actions/setup-node@v5'28 with:29 node-version-file: '.nvmrc'30 cache: 'npm'31 cache-dependency-path: 'package-lock.json'32 registry-url: 'https://registry.npmjs.org'33 scope: '@qwen-code'34 35 - name: 'Determine version'36 id: 'version'37 run: |38 if [[ "$GITHUB_REF" == refs/tags/mobile-mcp-v* ]]; then39 VERSION="${GITHUB_REF#refs/tags/mobile-mcp-v}"40 else41 VERSION="${{ inputs.version }}"42 fi43 echo "version=$VERSION" >> "$GITHUB_OUTPUT"44 45 - name: 'Install dependencies'46 working-directory: 'packages/mobile-mcp'47 run: 'npm ci --ignore-scripts'48 49 - name: 'Set version'50 working-directory: 'packages/mobile-mcp'51 run: 'npm version "${{ steps.version.outputs.version }}" --no-git-tag-version'52 53 - name: 'Build'54 working-directory: 'packages/mobile-mcp'55 run: 'npm run build'56 57 - name: 'Test'58 working-directory: 'packages/mobile-mcp'59 run: 'npx playwright test test/coord-norm.test.ts'60 61 - name: 'Publish'62 if: '${{ !inputs.dry_run }}'63 working-directory: 'packages/mobile-mcp'64 run: 'npm publish --access public'65 env:66 NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'67 