mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-07-16 16:50:26 +00:00
Add step to change the repo name to lowercase Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
62 lines
2.0 KiB
YAML
62 lines
2.0 KiB
YAML
name: Build and publish a Docker image
|
|
on:
|
|
push:
|
|
branches: ['main']
|
|
|
|
concurrency:
|
|
group: "docker-${{ github.ref }}"
|
|
cancel-in-progress: true
|
|
|
|
# Used for the Container registry domain and Docker image name
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
|
|
jobs:
|
|
build-and-push-image:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- dockerfile: ./docker/Dockerfile
|
|
tag: latest
|
|
- dockerfile: ./docker/Dockerfile.cu13
|
|
tag: cu13
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Lowercase image name
|
|
id: image
|
|
run: echo "name=$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
|
|
|
|
# Adds "latest" tag to the newly built image
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}
|
|
tags: type=raw,value=${{ matrix.tag }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# Builds and pushes the Docker image to GitHub Packages
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85
|
|
with:
|
|
file: ${{ matrix.dockerfile }}
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:buildcache-${{ matrix.tag }}
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:buildcache-${{ matrix.tag }},mode=max
|