Skip to content

feat: overhaul

feat: overhaul #1

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build Go Application
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3
# Set up Go environment
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21
# Build the application
- name: Build Go Application
run: |
go mod tidy
go build -o app .
docker-build:
name: Build Docker Image
runs-on: ubuntu-latest
needs: build # Ensure this job runs after "build"
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3
# Build the Docker image
- name: Build Docker Image
run: |
docker build -t clamav-prometheus-exporter:latest .
push:
name: Push Docker Image to Docker Hub
runs-on: ubuntu-latest
needs: [build, docker-build] # Ensure this job runs after "build" and "docker-build"
if: github.event_name == 'push' # Only run for "push" events, not "pull_request"
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3
# Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# Push the Docker image
- name: Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/clamav-prometheus-exporter:latest .
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/clamav-prometheus-exporter:latest