feat: add loved and liked all recommendation catalogs (#85) #37
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 | |
| paths: | |
| - 'app/core/version.py' | |
| - 'pyproject.toml' | |
| concurrency: | |
| group: ${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.CR_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Read version from version.py | |
| id: get-version | |
| run: | | |
| # Try Python import first | |
| VERSION=$(python -c "import sys; sys.path.insert(0, '.'); from app.core.version import __version__; print(__version__)" 2>/dev/null || echo "") | |
| # Fallback to regex if import fails | |
| if [ -z "${VERSION}" ]; then | |
| VERSION=$(grep -oP '__version__\s*=\s*"\K[^"]*' app/core/version.py || echo "0.0.0") | |
| fi | |
| echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Read version: ${VERSION}" | |
| - name: Set Docker image tag | |
| id: set-tag | |
| run: | | |
| VERSION="${{ steps.get-version.outputs.VERSION }}" | |
| echo "IMAGE_TAG=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Building Docker image with version: ${VERSION}" | |
| - name: Build and Push Docker image | |
| working-directory: "./" | |
| run: | | |
| REPO_NAME="${GITHUB_REPOSITORY,,}" | |
| IMAGE_TAG="${{ steps.set-tag.outputs.IMAGE_TAG }}" | |
| docker buildx build \ | |
| --platform linux/amd64,linux/arm64 \ | |
| -t ghcr.io/${REPO_NAME}:${IMAGE_TAG} \ | |
| -t ghcr.io/${REPO_NAME}:latest \ | |
| --push \ | |
| . | |
| - name: Create and Push Git Tag | |
| run: | | |
| VERSION="${{ steps.get-version.outputs.VERSION }}" | |
| # Check if tag already exists | |
| if git rev-parse "$VERSION" >/dev/null 2>&1; then | |
| echo "Tag $VERSION already exists, skipping" | |
| else | |
| echo "Creating tag: $VERSION" | |
| git tag $VERSION | |
| git push origin $VERSION | |
| fi |