Release Management #1
Workflow file for this run
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: Release Management | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: 'Version bump type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| - prerelease | |
| prerelease_tag: | |
| description: 'Prerelease tag (alpha, beta, rc)' | |
| required: false | |
| default: 'alpha' | |
| env: | |
| NODE_VERSION: '20.x' | |
| jobs: | |
| # Automated version management | |
| version-bump: | |
| name: Version Bump | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' | |
| outputs: | |
| new_version: ${{ steps.version.outputs.new_version }} | |
| new_tag: ${{ steps.version.outputs.new_tag }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Configure git | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Bump version | |
| id: version | |
| run: | | |
| if [ "${{ github.event.inputs.version_type }}" = "prerelease" ]; then | |
| NEW_VERSION=$(npm version prerelease --preid=${{ github.event.inputs.prerelease_tag }} --no-git-tag-version) | |
| else | |
| NEW_VERSION=$(npm version ${{ github.event.inputs.version_type }} --no-git-tag-version) | |
| fi | |
| echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT | |
| echo "new_tag=v${NEW_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Update changelog | |
| run: | | |
| # Generate changelog entry | |
| echo "## ${NEW_VERSION} - $(date +%Y-%m-%d)" >> CHANGELOG_NEW.md | |
| echo "" >> CHANGELOG_NEW.md | |
| # Get commits since last tag | |
| LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| if [ -n "$LAST_TAG" ]; then | |
| git log ${LAST_TAG}..HEAD --pretty=format:"- %s (%h)" >> CHANGELOG_NEW.md | |
| else | |
| git log --pretty=format:"- %s (%h)" >> CHANGELOG_NEW.md | |
| fi | |
| echo "" >> CHANGELOG_NEW.md | |
| echo "" >> CHANGELOG_NEW.md | |
| # Prepend to existing changelog | |
| if [ -f CHANGELOG.md ]; then | |
| cat CHANGELOG.md >> CHANGELOG_NEW.md | |
| fi | |
| mv CHANGELOG_NEW.md CHANGELOG.md | |
| - name: Commit version bump | |
| run: | | |
| git add package.json package-lock.json CHANGELOG.md | |
| git commit -m "chore: bump version to ${{ steps.version.outputs.new_version }}" | |
| git tag ${{ steps.version.outputs.new_tag }} | |
| git push origin main | |
| git push origin ${{ steps.version.outputs.new_tag }} | |
| # Create GitHub release | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [version-bump] | |
| if: always() && (needs.version-bump.result == 'success' || github.event_name == 'push') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| - name: Create package | |
| run: npm pack | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| else | |
| VERSION=${{ needs.version-bump.outputs.new_version }} | |
| fi | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Generate release notes | |
| id: release_notes | |
| run: | | |
| # Extract changelog for this version | |
| if [ -f CHANGELOG.md ]; then | |
| awk '/^## '${{ steps.version.outputs.version }}'/{flag=1; next} /^## /{flag=0} flag' CHANGELOG.md > RELEASE_NOTES.md | |
| else | |
| echo "Release ${{ steps.version.outputs.version }}" > RELEASE_NOTES.md | |
| fi | |
| - name: Create GitHub Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| release_name: Release v${{ steps.version.outputs.version }} | |
| body_path: RELEASE_NOTES.md | |
| draft: false | |
| prerelease: ${{ contains(steps.version.outputs.version, 'alpha') || contains(steps.version.outputs.version, 'beta') || contains(steps.version.outputs.version, 'rc') }} | |
| - name: Upload release assets | |
| run: | | |
| gh release upload v${{ steps.version.outputs.version }} vibe-coder-mcp-*.tgz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Trigger main CI/CD pipeline | |
| trigger-publish: | |
| name: Trigger Publication | |
| runs-on: ubuntu-latest | |
| needs: [create-release] | |
| steps: | |
| - name: Trigger CI/CD pipeline | |
| run: | | |
| echo "GitHub release created, CI/CD pipeline will handle publication" |