refact(actions): use build & push action instead of makefile (#315)

Signed-off-by: shubham <shubham.bajpai@mayadata.io>
This commit is contained in:
Shubham Bajpai 2021-04-27 19:31:08 +05:30 committed by GitHub
parent cb3ae22f7a
commit be4334f7c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 121 additions and 19 deletions

View file

@ -13,10 +13,21 @@
# limitations under the License.
name: build
on: ['push']
on:
create:
push:
branches:
- master
- 'v*'
paths-ignore:
- 'docs/**'
- 'changelogs/**'
- 'deploy/helm/**'
- 'CHANGELOG.md'
jobs:
lint:
if: ${{ (github.event.ref_type == 'branch') }} # to ignore builds on release
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -33,6 +44,7 @@ jobs:
unit-test:
if: ${{ (github.event.ref_type == 'branch') }} # to ignore builds on release
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -97,6 +109,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set Image Org
# sets the default IMAGE_ORG to openebs
run: |
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
- name: Set Tag
run: |
BRANCH="${GITHUB_REF##*/}"
@ -107,10 +125,28 @@ jobs:
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- name: Set Build Date
id: date
run: |
echo "::set-output name=DATE::$(date -u +'%Y-%m-%dT%H:%M:%S%Z')"
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
# add each registry to which the image needs to be pushed here
images: |
${{ env.IMAGE_ORG }}/zfs-driver
quay.io/${{ env.IMAGE_ORG }}/zfs-driver
tag-latest: false
tag-custom-only: true
tag-custom: |
${{ env.TAG }}
- name: Print Tag info
run: |
echo "BRANCH: ${BRANCH}"
echo "TAG: ${TAG}"
echo "${{ steps.docker_meta.outputs.tags }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
@ -129,9 +165,24 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build & Push Image
env:
IMAGE_ORG: ${{ secrets.IMAGE_ORG}}
run: |
make docker.buildx.csi-driver
make buildx.push.csi-driver
uses: docker/build-push-action@v2
with:
context: .
file: ./buildscripts/zfs-driver/zfs-driver.Dockerfile
push: true
platforms: linux/amd64, linux/arm64
tags: |
${{ steps.docker_meta.outputs.tags }}
build-args: |
DBUILD_DATE=${{ steps.date.outputs.DATE }}
DBUILD_REPO_URL=https://github.com/openebs/zfs-localpv
DBUILD_SITE_URL=https://openebs.io
BRANCH=${{ env.BRANCH }}