diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b79a4a4..a59069c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,8 @@ name: Learn Layer5 on: push: branches: [ master ] + tags: + - 'v*' pull_request: branches: [ master ] @@ -25,5 +27,12 @@ jobs: - name: Docker build & push if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && success() run: | - make build-img-service - make image-push + cd service && docker build --no-cache -t ${{ secrets.IMAGE_NAME }} . + docker tag ${{ secrets.IMAGE_NAME }}:latest ${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::6} + docker push ${{ secrets.IMAGE_NAME }}:latest + docker push ${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::6} + - name: Docker tag release & push + if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() + run: | + docker tag ${{ secrets.IMAGE_NAME }}:latest ${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//} + docker push ${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//} \ No newline at end of file