From de6b8fd2952ca912206fd4d7adc6d2913e9e0375 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Wed, 30 Oct 2024 22:26:07 +0100 Subject: [PATCH] Introduce deployment --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98c7bba..e7f2d88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,21 +4,46 @@ on: [ push, pull_request ] jobs: test: - name: ${{ matrix.config.image-name }} + name: ${{ matrix.config.image-slug }} runs-on: ubuntu-latest strategy: matrix: config: - - { docker-file: 'Dockerfile.cpu', image-name: 'facefusion-cpu' } - - { docker-file: 'Dockerfile.cuda', image-name: 'facefusion-cuda' } - - { docker-file: 'Dockerfile.tensorrt', image-name: 'facefusion-tensorrt' } - - { docker-file: 'Dockerfile.rocm', image-name: 'facefusion-rocm' } + - { docker-file: 'Dockerfile.cpu', image-slug: 'facefusion/facefusion:${{ github.ref_name }}-cpu' } + - { docker-file: 'Dockerfile.cuda', image-slug: 'facefusion/facefusion:${{ github.ref_name }}-cuda' } + - { docker-file: 'Dockerfile.tensorrt', image-slug: 'facefusion/facefusion:${{ github.ref_name }}-tensorrt' } + - { docker-file: 'Dockerfile.rocm', image-slug: 'facefusion/facefusion:${{ github.ref_name }}-rocm' } steps: - name: Checkout uses: actions/checkout@v2 - name: Build - run: docker build -f ${{ matrix.config.docker-file }} -t ${{ matrix.config.image-name }} . + run: docker build -f ${{ matrix.config.docker-file }} -t ${{ matrix.config.image-slug }} . - name: Run - run: docker run -d ${{ matrix.config.image-name }} + run: docker run -d ${{ matrix.config.image-slug }} - name: Validate - run: docker ps | grep -q ${{ matrix.config.image-name }} + run: docker ps | grep -q ${{ matrix.config.image-slug }} + deploy: + name: ${{ matrix.config.image-slug }} + runs-on: ubuntu-latest + needs: test + strategy: + matrix: + config: + - { docker-file: 'Dockerfile.cpu', image-slug: 'facefusion/facefusion:${{ github.ref_name }}-cpu' } + - { docker-file: 'Dockerfile.cuda', image-slug: 'facefusion/facefusion:${{ github.ref_name }}-cuda' } + - { docker-file: 'Dockerfile.tensorrt', image-slug: 'facefusion/facefusion:${{ github.ref_name }}-tensorrt' } + - { docker-file: 'Dockerfile.rocm', image-slug: 'facefusion/facefusion:${{ github.ref_name }}-rocm' } + steps: + - name: Login + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Checkout + uses: actions/checkout@v2 + - name: Build + run: docker build -f ${{ matrix.config.docker-file }} -t ${{ matrix.config.image-slug }} . + - name: Deploy + run: docker push ${{ matrix.config.image-slug }} + - name: Logout + run: docker logout