new build #28
This file contains hidden or 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: Docker Image CI | |
on: | |
push: | |
branches: [ "master" ] | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build-and-push: | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/vmware-exporter:latest | |
ghcr.io/${{ github.repository_owner }}/vmware-exporter:latest | |
build-latest: | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build the Docker image and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: prezhdarov/vmware-exporter:latest | |
build-version: | |
if: ${{ github.ref_type == 'tag' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build the Docker image and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: prezhdarov/vmware-exporter:${{ github.ref_name }} |