Bump tornado from 6.5.1 to 6.5.5 #5
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: Auto Release | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| pull-requests: write | ||
| issues: write | ||
| jobs: | ||
| analyze-changes: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| should-release: ${{ steps.changes.outputs.should-release }} | ||
| release-type: ${{ steps.changes.outputs.release-type }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Analyze commit messages | ||
| id: changes | ||
| run: | | ||
| # Get commits since last tag | ||
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | ||
| if [ -z "$LAST_TAG" ]; then | ||
| echo "should-release=true" >> $GITHUB_OUTPUT | ||
| echo "release-type=minor" >> $GITHUB_OUTPUT | ||
| echo "First release - suggesting minor version" | ||
| exit 0 | ||
| fi | ||
| # Check commit messages for conventional commits | ||
| COMMITS=$(git log --oneline ${LAST_TAG}..HEAD --pretty=format:"%s") | ||
| HAS_BREAKING=false | ||
| HAS_FEAT=false | ||
| HAS_FIX=false | ||
| while IFS= read -r commit; do | ||
| if [[ $commit =~ ^feat(\(.+\))?!:|^[^:]+!:|BREAKING[[:space:]]CHANGE ]]; then | ||
| HAS_BREAKING=true | ||
| elif [[ $commit =~ ^feat(\(.+\))?: ]]; then | ||
| HAS_FEAT=true | ||
| elif [[ $commit =~ ^fix(\(.+\))?: ]]; then | ||
| HAS_FIX=true | ||
| fi | ||
| done <<< "$COMMITS" | ||
| # Determine release type | ||
| if [ "$HAS_BREAKING" = true ]; then | ||
| RELEASE_TYPE="major" | ||
| elif [ "$HAS_FEAT" = true ]; then | ||
| RELEASE_TYPE="minor" | ||
| elif [ "$HAS_FIX" = true ]; then | ||
| RELEASE_TYPE="patch" | ||
| else | ||
| RELEASE_TYPE="none" | ||
| fi | ||
| # Only release if there are significant changes | ||
| if [ "$RELEASE_TYPE" != "none" ]; then | ||
| echo "should-release=true" >> $GITHUB_OUTPUT | ||
| echo "release-type=$RELEASE_TYPE" >> $GITHUB_OUTPUT | ||
| echo "Suggesting $RELEASE_TYPE release" | ||
| else | ||
| echo "should-release=false" >> $GITHUB_OUTPUT | ||
| echo "release-type=none" >> $GITHUB_OUTPUT | ||
| echo "No significant changes - skipping release" | ||
| fi | ||
| auto-release: | ||
| runs-on: ubuntu-latest | ||
| needs: analyze-changes | ||
| if: needs.analyze-changes.outputs.should-release == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v4 | ||
| with: | ||
| version: "latest" | ||
| enable-cache: true | ||
| - name: Set up Python | ||
| run: uv python install 3.11 | ||
| - name: Install dependencies | ||
| run: uv sync --dev | ||
| - name: Run tests | ||
| env: | ||
| POSTGRES_USER: test_user | ||
| POSTGRES_PASSWORD: test_pass | ||
| POSTGRES_SERVER: localhost | ||
| POSTGRES_PORT: 5432 | ||
| POSTGRES_DB: test_db | ||
| S3_ACCESS_KEY_ID: test_key | ||
| S3_ACCESS_KEY: test_secret | ||
| S3_BUCKET: test-bucket | ||
| REDIS_HOST: localhost | ||
| REDIS_PORT: 6379 | ||
| ENVIRONMENT: testing | ||
| DEBUG: false | ||
| LOG_LEVEL: WARNING | ||
| services: | ||
| postgres: | ||
| image: postgres:15 | ||
| env: | ||
| POSTGRES_USER: test_user | ||
| POSTGRES_PASSWORD: test_pass | ||
| POSTGRES_DB: test_db | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| ports: | ||
| - 5432:5432 | ||
| redis: | ||
| image: redis:7 | ||
| options: >- | ||
| --health-cmd "redis-cli ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| ports: | ||
| - 6379:6379 | ||
| run: | | ||
| uv run pytest src/tests/ -v --tb=short | ||
| - name: Configure git | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| - name: Bump version and create release | ||
| run: | | ||
| chmod +x scripts/bump-version.sh | ||
| RELEASE_TYPE="${{ needs.analyze-changes.outputs.release-type }}" | ||
| ./scripts/bump-version.sh $RELEASE_TYPE "Auto-release: $RELEASE_TYPE version bump" | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| pr-preview: | ||
| runs-on: ubuntu-latest | ||
| needs: analyze-changes | ||
| if: github.event_name == 'pull_request' | ||
| steps: | ||
| - name: Comment on PR | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const { should-release, release-type } = ${{ toJson(needs.analyze-changes.outputs) }}; | ||
| let message; | ||
| if (should-release === 'true') { | ||
| message = `🎯 **Release Preview** | ||
| This PR will trigger a **${release-type}** release when merged to main. | ||
| ### What this means: | ||
| - Version will be bumped (${release-type}) | ||
| - GitHub release will be created | ||
| - Python package will be built | ||
| - Changelog will be updated | ||
| ### Release Type Explanation: | ||
| - **major**: Breaking changes (x.0.0) | ||
| - **minor**: New features (0.x.0) | ||
| - **patch**: Bug fixes (0.0.x)`; | ||
| } else { | ||
| message = `📋 **Release Preview** | ||
| This PR will **not** trigger an automatic release. | ||
| No significant changes detected based on commit messages. | ||
| To trigger a release, use conventional commit messages: | ||
| - \`feat:\` for new features (minor release) | ||
| - \`fix:\` for bug fixes (patch release) | ||
| - \`feat!:\` or \`BREAKING CHANGE:\` for breaking changes (major release)`; | ||
| } | ||
| github.rest.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: message | ||
| }); | ||