Skip to content

chore: try to add broken test to see how ci/cd will handle it #45

chore: try to add broken test to see how ci/cd will handle it

chore: try to add broken test to see how ci/cd will handle it #45

Workflow file for this run

name: Complete CI/CD Pipeline (Test, Deploy & Release)
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
AWS_REGION: us-east-2
NODE_VERSION: '22'
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- run: npm ci
- run: npm run test
- run: npm run build
deploy-dev:
name: Deploy to Development
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
environment: development
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- run: npm ci
- run: chmod +x iac/scripts/deploy-apprunner.sh
- run: ./iac/scripts/deploy-apprunner.sh dev ${{ vars.APPRUNNER_SERVICE_NAME_DEV }}
check-version:
name: Check Version Bump
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
outputs:
version-changed: ${{ steps.version-check.outputs.changed }}
new-version: ${{ steps.version-check.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: version-check
run: |
CURRENT_VERSION=$(jq -r .version package.json)
git checkout HEAD~1
PREVIOUS_VERSION=$(jq -r .version package.json)
git checkout HEAD
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
deploy-prod-and-publish:
name: Deploy Production & Publish NPM
runs-on: ubuntu-latest
needs: [check-version]
if: github.ref == 'refs/heads/main' && needs.check-version.outputs.version-changed == 'true'
environment: production
steps:
- uses: actions/checkout@v4
# Deploy to App Runner first
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
# Deploy to production
- run: chmod +x iac/scripts/deploy-apprunner.sh
- run: ./iac/scripts/deploy-apprunner.sh prod ${{ vars.APPRUNNER_SERVICE_NAME_PROD }}
# Publish to NPM after successful deployment
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Create GitHub release
- uses: actions/create-release@v1
with:
tag_name: v${{ needs.check-version.outputs.new-version }}
release_name: Release v${{ needs.check-version.outputs.new-version }}
body: |
🚀 **Carbon Voice v${{ needs.check-version.outputs.new-version }}**
✅ Deployed to production: https://${{ vars.APPRUNNER_SERVICE_NAME_PROD }}.us-east-2.awsapprunner.com
✅ Published to NPM: `npm install cv-mcp-server@${{ needs.check-version.outputs.new-version }}`
Install via NPM:
```bash
npm install cv-mcp-server@${{ needs.check-version.outputs.new-version }}
```
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}