Skip to content

Push to ghcr

Push to ghcr #16

name: Build and push to GHCR
on:
push:
branches: [main]
pull_request:
env:
GHCR_URL: ghcr.io/coqui-ai/xtts-streaming-server
jobs:
build-and-push-to-ghcr:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v3
- name: Set Release version
shell: bash
run: |
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
echo "RELEASE_VERSION=dev" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
fi
export TAG=${GHCR_URL}:${{ env.RELEASE_VERSION }}-${{ github.sha }}
-
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'
run: |
set -xe
docker login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Build only for PR
if: github.ref != 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:server"
file: Dockerfile
push: false
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest
tags: coqui-ai/xtts-streaming-server:latest
#build-args:
- name: Build and Push image
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:server"
file: Dockerfile
push: false
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest
tags: coqui-ai/xtts-streaming-server:latest, coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }}
#build-args: