Skip to content

Create build.yaml

Create build.yaml #1

Workflow file for this run

name: Build
on:
pull_request:
branches:
- main
- dev
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
- run: make init
- run: env CGO_ENABLED=0 make build
- name: Docker build
run: docker build . --tag ${{ secrets.DOCKERHUB_USERNAME }}/mongodb-exporter:latest
- name: Docker login
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/mongodb-exporter:latest