Skip to content

image_generate

image_generate #54

name: image_generate
on:
push:
branches: [ master ]
paths:
- '.github/workflows/image_generate.yml'
- '.github/docker/generate/*'
schedule:
- cron: '45 18 28 * *'
workflow_dispatch:
jobs:
build:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
if: github.repository == 'freetz-ng/freetz-ng'
steps:
- name: checkout
uses: actions/checkout@v4
- name: prepare
id: prepare
run: |
OWNER="$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')"
[ -z "$OWNER" ] && OWNER="$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')"
[ -n "$OWNER" ] && echo "owner=$OWNER" >> $GITHUB_OUTPUT || exit 1
IMAGE="$(echo "${{ github.workflow }}" | sed 's/.*_//')"
[ -n "$IMAGE" ] && echo "image=$IMAGE" >> $GITHUB_OUTPUT || exit 1
for x in Dockerfile entrypoint.sh; do ln -s .github/docker/$IMAGE/$x; done
echo "################################################################" && echo "URI=$OWNER/$IMAGE"
- name: login
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ steps.prepare.outputs.owner }}/${{ steps.prepare.outputs.image }}:latest