Browse Source

fixed github actions

Matthew R Kasun 4 years ago
parent
commit
252817b7ca
1 changed files with 37 additions and 41 deletions
  1. 37 41
      .github/workflows/publish-docker.yml

+ 37 - 41
.github/workflows/publish-docker.yml

@@ -1,45 +1,41 @@
 name: Publish Docker
 name: Publish Docker
 
 
-on: 
+on:
   pull_request:
   pull_request:
-        branches: 
-        - 'develop'
-        - 'master' 
+    branches:
+      - 'develop'
+      - 'master'
+
 jobs:
 jobs:
-    docker:
-        runs-on: ubuntu-latest
-        steps:
-            -
-                name: Set Environment Variables
-                run: |
-                    echo "BUILD_VER=v0.0.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
-                    if ${{ github.head_ref }} = "master" ]
-                    then
-                        echo "TAG=latest" >>$GITHUB_ENV
-                    else
-                        echo "TAG=${{ github.head_ref}}" >> $GITHUB_ENV
-                    done
-            -
-                name: Checkout
-                uses: actions/checkout@v2
-            -
-                name: Set up QEMU
-                uses: docker/setup-qemu-action@v1
-            -
-                name: Set up Docker Buildx
-                uses: docker/setup-buildx-action@v1
-            -
-                name: Login to DockerHub
-                uses: docker/login-action@v1
-                with:
-                    username: ${{ secrets.DOCKERHUB_USERNAME }}
-                    password: ${{ secrets.DOCKERHUB_TOKEN }}
-            -
-                name: Build and push
-                uses: docker/build-push-action@v2
-                with:
-                    context: .
-                    platforms: linux/amd64, linux/arm64
-                    push: false
-                    tags: |
-                        nusak/netmaker:${{ env.TAG }}
+  docker:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v1
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v1
+      - name: Login to DockerHub
+        uses: docker/login-action@v1
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: Build and push latest
+        if: github.base_ref == 'master'
+        uses: docker/build-push-action@v2
+        with:
+          context: .
+          platforms: linux/amd64, linux/arm64
+          push: true
+          tags: |
+            nusak/netmaker:latest
+      - name: Build and push develop
+        if: github.base_ref == 'develop'
+        uses: docker/build-push-action@v2
+        with:
+          context: .
+          platforms: linux/amd64, linux/arm64
+          push: true
+          tags: |
+            nusak/netmaker:develop