From a42554b077fca697a104c65fc65348d5fef7229d Mon Sep 17 00:00:00 2001 From: Nickolay Kondratenko Date: Sun, 25 May 2025 19:26:09 +0300 Subject: [PATCH 1/3] publish docker images --- .github/workflows/test.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 76ae353..c69ec01 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,4 +38,35 @@ jobs: files: coverage.out token: ${{ secrets.CODECOV_TOKEN }} flags: unittests - name: codecov-report \ No newline at end of file + name: codecov-report + + docker: + name: Build and Push Docker Images + needs: test + runs-on: ubuntu-latest + if: success() + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set image tag + id: vars + run: echo "TAG=ghcr.io/${{ github.repository_owner }}/server:latest" >> $GITHUB_OUTPUT + + - name: Build and push server image + run: | + docker build -f Dockerfile -t ${{ steps.vars.outputs.TAG }} . + docker push ${{ steps.vars.outputs.TAG }} + + - name: Build and push client image + run: | + docker build -f Dockerfile.client -t ${{ steps.vars.outputs.TAG }}-client . + docker push ${{ steps.vars.outputs.TAG }}-client From ecb6a33baa0b500e01fb48a322e764786c0b6a34 Mon Sep 17 00:00:00 2001 From: Nickolay Kondratenko Date: Sun, 25 May 2025 19:48:58 +0300 Subject: [PATCH 2/3] fix image tags --- .github/workflows/test.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c69ec01..a24c719 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,14 +59,16 @@ jobs: - name: Set image tag id: vars - run: echo "TAG=ghcr.io/${{ github.repository_owner }}/server:latest" >> $GITHUB_OUTPUT + run: | + echo "SERVER_TAG=ghcr.io/${{ github.repository_owner }}/server:latest" >> $GITHUB_OUTPUT + echo "CLIENT_TAG=ghcr.io/${{ github.repository_owner }}/client:latest" >> $GITHUB_OUTPUT - name: Build and push server image run: | - docker build -f Dockerfile -t ${{ steps.vars.outputs.TAG }} . - docker push ${{ steps.vars.outputs.TAG }} + docker build -f Dockerfile -t ${{ steps.vars.outputs.SERVER_TAG }} . + docker push ${{ steps.vars.outputs.SERVER_TAG }} - name: Build and push client image run: | - docker build -f Dockerfile.client -t ${{ steps.vars.outputs.TAG }}-client . - docker push ${{ steps.vars.outputs.TAG }}-client + docker build -f Dockerfile.client -t ${{ steps.vars.outputs.CLIENT_TAG }} . + docker push ${{ steps.vars.outputs.CLIENT_TAG }} From 0fc7d757bbfeaa96f010e12372076eed2a62fc8d Mon Sep 17 00:00:00 2001 From: Nickolay Kondratenko Date: Sun, 25 May 2025 19:57:59 +0300 Subject: [PATCH 3/3] publish docker images on master only --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a24c719..004a478 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,7 @@ jobs: name: Build and Push Docker Images needs: test runs-on: ubuntu-latest - if: success() + if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - name: Checkout code