-
Notifications
You must be signed in to change notification settings - Fork 86
48 lines (43 loc) · 1.71 KB
/
build-and-push-to-ghcr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 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 # Do not push image for PR
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }}
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }}
tags: coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }}
#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: true # Push if merged
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest
tags: coqui-ai/xtts-streaming-server:latest, coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }}
#build-args: