瀏覽代碼

make docker workflow trigger on tags

Vladislav Yarmak 1 年之前
父節點
當前提交
b89fd39889
共有 1 個文件被更改,包括 10 次插入11 次删除
  1. 10 11
      .github/workflows/docker-ci.yml

+ 10 - 11
.github/workflows/docker-ci.yml

@@ -1,8 +1,9 @@
 name: docker-ci
 
 on:
-  release:
-    types: [published]
+  push:
+    tags:
+      - 'v*'
 
 jobs:
   docker:
@@ -10,7 +11,7 @@ jobs:
     steps:
       -
         name: Checkout
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
         with:
           fetch-depth: 0
       -
@@ -24,13 +25,9 @@ jobs:
           skip-unshallow: 'true'
           abbrev: 7
       -
-        name: Determine image tag type
-        uses: haya14busa/action-cond@v1
-        id: imgtag
-        with:
-          cond: ${{ github.event_name == 'release' }}
-          if_true: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ github.event.release.tag_name }},${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
-          if_false: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
+        name: Compute Docker tag
+        id: docker_tag
+        run: echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
       -
         name: Set up QEMU
         uses: docker/setup-qemu-action@v1
@@ -51,5 +48,7 @@ jobs:
           context: .
           platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
           push: true
-          tags: ${{ steps.imgtag.outputs.value }}
+          tags:
+            - ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ steps.docker_tag.outputs.tag }}
+            - ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
           build-args: 'GIT_DESC=${{steps.tagger.outputs.tag}}'