Skip to content

Build ci image and push image to ghcr.io #145

Build ci image and push image to ghcr.io

Build ci image and push image to ghcr.io #145

name: Build ci image and push image to ghcr.io
on:
# Run every day at 07:00 UTC
schedule:
- cron: '0 7 * * *'
workflow_dispatch:
# push:
# branches:
# - "main"
permissions:
contents: read
packages: write
jobs:
build-ci-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }} # Image name based on repo
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: . # Path to your Dockerfile and build context
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}