containers/.forgejo/workflows/build-images.yaml

45 lines
1.4 KiB
YAML
Raw Normal View History

name: "Build and Push Images"
2024-11-03 20:28:20 +00:00
on:
#push:
# paths:
# - 'apps/*/Dockerfile'
2024-11-03 20:28:20 +00:00
workflow_dispatch:
inputs:
app:
type: string
2025-01-03 13:52:14 +00:00
description: "App to build, e.g. 'home-assistant'"
required: true
2024-12-30 20:50:06 +00:00
2024-11-03 20:28:20 +00:00
jobs:
2024-12-30 20:50:06 +00:00
build-and-push:
runs-on: ci-os
steps:
- name: Checkout
2024-12-30 20:50:06 +00:00
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"
2025-01-03 13:52:14 +00:00
- id: read-version
name: Read Version from version.sh
run: |
version=$(bash "${{ steps.set-context.outputs.context_dir }}/ci/version.sh" || echo "")
2025-01-03 13:58:20 +00:00
echo "Version being built: $version"
2025-01-03 13:52:14 +00:00
echo "version=$version" >> "$GITHUB_OUTPUT"
2024-12-30 20:50:06 +00:00
- name: Build and Push with Kaniko
uses: https://code.252.no/pub/kaniko-action@latest
with:
context: ${{ steps.set-context.outputs.context_dir }}
2025-01-03 13:52:14 +00:00
destinations: >
2025-01-03 13:54:55 +00:00
code.252.no/${{ github.repository }}/${{ github.event.inputs.app }}:latest code.252.no/${{ github.repository }}/${{ github.event.inputs.app }}:${{ steps.read-version.outputs.version }}
2025-01-03 13:58:20 +00:00
build_args: |
VERSION="${{ steps.read-version.outputs.version }}"
2024-12-30 20:50:06 +00:00
credentials: "code.252.no=tommy:${{ secrets.REGISTRY_TOKEN }}"
push: "true"
2025-01-03 13:52:14 +00:00
cache: "false"