diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ac1bba..5e2b137 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,8 @@ on: push: branches: - master + tags: + - '*' jobs: backend_test_build_and_push_to_docker_registry: #disable backend in test branch @@ -22,10 +24,21 @@ jobs: DOCKER_PASSWORD: ${{secrets.DOCKER_ACCESS_TOKEN}} run: | echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + + - name: Determine Docker Image Name + id: image + run: | + if [[ "${{github.ref_name}}" == "master" ]]; then + echo "name=xinfinorg/subnet-stats-service:latest" >> $GITHUB_OUTPUT + else + echo "name=xinfinorg/subnet-stats-service:${{github.ref_name}}" >> $GITHUB_OUTPUT + fi + - name: Docker build and tag image - run: cd backend && docker build . --file Dockerfile --tag xinfinorg/subnet-stats-service:latest + run: cd backend && docker build . --file Dockerfile --tag ${{ steps.image.outputs.name }} + - name: Docker push - run: docker push xinfinorg/subnet-stats-service:latest + run: docker push ${{ steps.image.outputs.name }} frontend_test_build_and_push_to_docker_registry: name: build and publish frontend image to docker hub @@ -45,3 +58,4 @@ jobs: run: cd frontend && docker build . --file Dockerfile --tag xinfinorg/subnet-frontend:latest - name: Docker push run: docker push xinfinorg/subnet-frontend:latest +