Browse Source

more events and tags

Matthew R Kasun 4 years ago
parent
commit
2ba67d0a60
1 changed files with 26 additions and 2 deletions
  1. 26 2
      .github/workflows/publish-docker.yml

+ 26 - 2
.github/workflows/publish-docker.yml

@@ -4,6 +4,13 @@ on:
   push:
         branches: 
         - 'arm-docker'
+        - 'develop'
+        - 'main'
+        tags:
+            - 'v*.*.*'
+  pull_request:
+        branches:
+            - 'main'
 jobs:
   docker:
     runs-on: ubuntu-latest
@@ -11,6 +18,22 @@ jobs:
       -
         name: Checkout
         uses: actions/checkout@v2
+      -
+        name: Docker Meta
+        id: meta
+        uses: crazy-max/ghaction-docker-meta@v2
+        with:
+            #list of images to use as base name for tags
+            images: |
+                nusak/netmaker
+            # generate Docker tags based on following events/attributes
+                tags: |
+                    type=ref,event=branch
+                    type=ref,event=pr
+                    type=semver,pattern={{version}}
+                    type=semver,pattern={{major}}.{{minor}}
+                    type=semver,pattern={{major}}
+                    type=sha
       -
         name: Set up QEMU
         uses: docker/setup-qemu-action@v1
@@ -29,6 +52,7 @@ jobs:
         with:
           context: .
           platforms: linux/amd64, linux/arm64
-          push: true
-          tags: nusak/netmaker:latest
+          push: ${{ github.event_name != 'pull_request' }}
+          tags: ${{ steps.meta.output.tags }}
+          labels: ${{ steps.meta.output.labels }}