add test branch PR and manual gen of docker images

This commit is contained in:
Matthew R Kasun 2021-04-25 09:59:41 -04:00
parent 5df6e948b3
commit 6f9da311ef

View file

@ -1,15 +1,30 @@
name: Publish Docker name: Publish Docker
on: on:
workflow_dispatch:
inputs:
tag:
description: 'docker tag'
required: true
pull_request: pull_request:
branches: branches:
- 'develop' - 'test'
- 'master' - 'master'
jobs: jobs:
docker: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set tag
run: |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
TAG=${{ github.event.inputs.tag }}
elif [[ "${{ github.base_ref }}" == 'master' ]]; then
TAG="latest"
else
TAG="${{ github.base_ref }}"
fi
echo "TAG=${TAG}" >> $GITHUB_ENV
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up QEMU - name: Set up QEMU
@ -22,20 +37,9 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push latest - name: Build and push latest
if: github.base_ref == 'master'
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
platforms: linux/amd64, linux/arm64 platforms: linux/amd64, linux/arm64
push: true push: true
tags: | tags: gravitl/netmaker:${{ env.TAG }}
gravitl/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: |
gravitl/netmaker:develop