Skip to content

Add AWS bedrock Provider #16

Add AWS bedrock Provider

Add AWS bedrock Provider #16

Workflow file for this run

name: Docker Build and Push
on:
push:
branches:
- 'main' # Only trigger push events on main
tags: [ "v*" ]
pull_request: # Keep PR triggers for all branches
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker:
# Skip this job if it's a push event on a non-main branch
if: github.event_name != 'push' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Generate Cargo.lock if it doesn't exist
- name: Generate Cargo.lock
run: |
if [ ! -f "Cargo.lock" ]; then
cargo generate-lockfile
fi
- name: Extract version from Cargo.toml
id: version
run: |
VERSION=$(awk -F '"' '/^version = / {print $2}' Cargo.toml)
echo "CARGO_VERSION=${VERSION}" >> $GITHUB_ENV
echo "Version found: ${VERSION}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Always build to verify Dockerfile, but push only on main
- name: Build Docker image (non-main branch)
if: github.ref != 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: .
push: false
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
# Main branch handling - build and push
- name: Log in to GitHub Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for GHCR
if: github.ref == 'refs/heads/main'
id: meta-ghcr
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=raw,value=${{ env.CARGO_VERSION }}
- name: Build and push to GitHub Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta-ghcr.outputs.tags }}
labels: ${{ steps.meta-ghcr.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Login to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
magicapi1/magicapi-ai-gateway:latest
magicapi1/magicapi-ai-gateway:${{ env.CARGO_VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64