containers/.forgejo/workflows/build-images.yaml
2025-01-03 14:52:19 +01:00

46 lines
1.5 KiB
YAML

name: "Build and Push Images"
on:
#push:
# paths:
# - 'apps/*/Dockerfile'
workflow_dispatch:
inputs:
app:
type: string
description: "App to build, e.g. 'home-assistant'"
required: true
jobs:
build-and-push:
runs-on: ci-os
steps:
- name: Checkout
uses: actions/checkout@v4
- id: set-context
name: Determine Context
run: |
context_dir="/workspace/pub/containers/apps/${{ github.event.inputs.app }}"
echo "context_dir=$context_dir" >> "$GITHUB_OUTPUT"
- id: read-version
name: Read Version from version.sh
run: |
version=$(bash "${{ steps.set-context.outputs.context_dir }}/ci/version.sh" || echo "")
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Build and Push with Kaniko
uses: https://code.252.no/pub/kaniko-action@latest
with:
# This is the directory that contains your Dockerfile, metadata.yaml, ci/version.sh, etc.
context: ${{ steps.set-context.outputs.context_dir }}
# Kaniko will look for "Dockerfile" by default in the `context` directory.
# Provide multiple tags (comma-separated) so you push both "latest" and a version-specific tag:
destinations: >
code.252.no/${{ github.repository }}/${{ github.event.inputs.app }}:latest, code.252.no/${{ github.repository }}/${{ github.event.inputs.app }}:${{ steps.read-version.outputs.version }}
credentials: "code.252.no=tommy:${{ secrets.REGISTRY_TOKEN }}"
push: "true"
cache: "false"