Add readme and workflow
All checks were successful
/ Build image (push) Successful in 1m52s

This commit is contained in:
Marko Korhonen 2024-02-25 11:40:59 +02:00
parent 31f55fd29f
commit d3046583fa
Signed by: FunctionalHacker
GPG key ID: A7F78BCB859CD890
2 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,44 @@
on:
push:
schedule:
- cron: '0 12 * * *'
jobs:
build_image:
name: Build image
env:
VERSION: 22.04
SCHEDULED: ${{ github.event_name == 'schedule' }}
PUSHED: ${{ github.event_name == 'push' }}
REGISTRY: git.korhonen.cc
REPO: ${{ env.REGISTRY }}/functionalhacker/ubuntu-act
runs-on: docker
steps:
- name: Check if update available
if: env.SCHEDULED
id: check
uses: https://github.com/ClementTsang/docker-check-base-image-diff@v0.0.2
with:
base-image: docker://ghcr.io/catthehacker/ubuntu:act-${{ env.VERSION }}
derived-image: docker://${{ env.REPO }}:latest
- name: Check result
if: env.SCHEDULED
run: echo "Needs updating = ${{ steps.check.outputs.differs }}"
- name: Set up Docker Buildx
if: env.PUSHED || ${{ steps.check.outputs.differs == true }}
uses: docker/setup-buildx-action@v3
- name: Login to Docker registry
if: env.PUSHED || ${{ steps.check.outputs.differs == true }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push image
if: env.PUSHED || ${{ steps.check.outputs.differs == true }}
uses: docker/build-push-action@v5
with:
push: true
build-args: VERSION=${{ env.VERSION }}
tags: |
${{ env.REPO }}:latest
${{ env.REPO }}:${{ env.VERSION }}