Skip to content

Build and publish Docker image #159

Build and publish Docker image

Build and publish Docker image #159

name: Build and publish Docker image
on:
schedule:
- cron: '0 0 * * MON'
push:
branches: [ main ]
paths-ignore: [ '**/README.md' ]
env:
IMAGE_NAME: icecast2
GITHUB_PACKAGES: ghcr.io
QUAY_IO: quay.io
jobs:
build_and_publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to GitHub Packages
uses: docker/login-action@v3
with:
registry: ${{ env.GITHUB_PACKAGES }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.QUAY_IO }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
${{ env.GITHUB_PACKAGES }}/${{ github.actor }}/${{ env.IMAGE_NAME }}:latest
${{ env.QUAY_IO }}/${{ secrets.QUAY_USERNAME }}/${{ env.IMAGE_NAME }}:latest