Skip to content

add github action to push to quay repo #1

add github action to push to quay repo

add github action to push to quay repo #1

Workflow file for this run

name: Build and Push Container
on:
push:
branches:
- main
tags:
- 'v*'
env:
IMAGE_NAME: quay.io/yourorg/vector-embedder
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Determine tags
id: meta
run: |
echo "sha_tag=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "is_tag=true" >> $GITHUB_OUTPUT
echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
else
echo "is_tag=false" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.sha_tag }}
${{ steps.meta.outputs.is_tag == 'true' && format('{0}:{1}', env.IMAGE_NAME, steps.meta.outputs.git_tag) || '' }}
${{ steps.meta.outputs.is_tag == 'false' && format('{0}:latest', env.IMAGE_NAME) || '' }}