name: Create Release

on:
  push:
    tags:
      - 'v*' # Trigger on version tags like v1.0.0, v2.1.3, etc.

jobs:
  build-and-release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          cache: 'npm'
          
      - name: Install dependencies
        run: npm ci
        
      - name: Build project
        run: npm run build
        env:
          BUILD_TYPE: release
          
      - name: Create release zip
        run: |
          cd dist
          zip -r ../release.zip .
          
      - name: Create Release
        uses: softprops/action-gh-release@v1
        with:
          files: release.zip
          generate_release_notes: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 