aur-deploy/.github/workflows/docker-image.yml
Cory Sanin b4a76e4209
All checks were successful
Docker Image CI / build (push) Successful in -42s
take 2
2025-05-21 16:43:00 -05:00

58 lines
1.5 KiB
YAML

name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 5 * * 3'
jobs:
build:
runs-on: ubuntu-latest
env:
DH_REGISTRY: docker.io
REPOSITORY: ${{ github.event.repository.name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Provide default tag username
if: ${{ env.DOCKER_USERNAME == '' }}
run: |
echo "DOCKER_USERNAME=remote" >> $GITHUB_ENV
- name: determine deployment
if: github.ref == 'refs/heads/master' && ( github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' )
run: echo "DEPLOY=true" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@v1
if: env.DEPLOY == 'true'
with:
registry: ${{ env.DH_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_USERNAME }}/${{ env.REPOSITORY }}
tags: type=raw,value=latest
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: ${{ env.DEPLOY }}
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}