update deployment #1
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 & Release Cerebro API | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'app/**' | |
| - 'requirements.txt' | |
| - 'Dockerfile' | |
| - '.github/workflows/build-and-release.yml' | |
| concurrency: | |
| group: cerebro-api-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| image_tag: ${{ steps.commit.outputs.short }} | |
| image_digest: ${{ steps.docker_build.outputs.digest }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get Organization Name | |
| id: org_name | |
| run: | | |
| org_name=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| echo "Organization Name: $org_name" | |
| echo "org_name=$org_name" >> $GITHUB_OUTPUT | |
| - name: Extract commit | |
| id: commit | |
| uses: prompt/actions-commit-hash@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push | |
| id: docker_build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ghcr.io/${{ steps.org_name.outputs.org_name }}/gc-cerebro-api:latest | |
| ghcr.io/${{ steps.org_name.outputs.org_name }}/gc-cerebro-api:${{ steps.commit.outputs.short }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Image Summary | |
| run: | | |
| echo "## 🐳 Docker Image Built" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| **Image** | \`ghcr.io/${{ steps.org_name.outputs.org_name }}/gc-cerebro-api\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "| **Tag** | \`${{ steps.commit.outputs.short }}\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "| **Digest** | \`${{ steps.docker_build.outputs.digest }}\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "| **Platforms** | \`linux/amd64, linux/arm64\` |" >> $GITHUB_STEP_SUMMARY |