fix: resolve ruff import ordering and unused import errors #101
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: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| # Set permissions for GITHUB_TOKEN | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Check out the repository code | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Step 2: Set up QEMU for multi-arch builds | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # Step 3: Set up Docker Buildx for advanced features | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Step 4: Log in to GitHub Container Registry | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Step 5: Generate tags and labels from Git metadata | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| # Tag with branch name | |
| type=ref,event=branch | |
| # Tag with PR number | |
| type=ref,event=pr | |
| # Tag with semver from git tag | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| # Tag with short SHA | |
| type=sha,prefix= | |
| # Step 6: Build and push the Docker image | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| # Only push on main branch and tags, not PRs | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # Enable build cache for faster builds | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |