Create build.yaml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |