actions/.forgejo/workflows/build.yaml
2023-11-16 17:11:15 +01:00

66 lines
No EOL
2.2 KiB
YAML

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build
on:
workflow_call:
secrets:
M8A_ORG_BOT_PACKAGE_TOKEN:
required: true
inputs:
context:
type: string
default: "."
required: false
dockerfile:
type: string
default: Dockerfile
required: false
outputs:
tags:
description: "Docker image tags"
value: ${{ jobs.build.outputs.tags }}
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.ref }}
jobs:
build:
outputs:
tags: ${{ steps.meta.outputs.tags }}
runs-on: ubuntu-latest
container:
# see https://code.forgejo.org/forgejo/act#runners
# and https://forgejo.org/docs/v1.20/user/actions/#forgejo-runner
# image: ghcr.io/catthehacker/ubuntu:full-latest
# image: ghcr.io/catthehacker/ubuntu:act-22.04
image: devthefuture/act-runner:latest
volumes:
- /buildkit-certs:/buildkit-certs
steps:
- name: ⏬ Checkout code repository
uses: actions/checkout@v4
- name: 📌 Extract metadata (tags, labels) for Docker
id: meta
uses: https://github.com/docker/metadata-action@v5
with:
images: git.devthefuture.org/${{ github.repository }}
tags: |
type=semver,pattern={{version}},priority=900
type=semver,pattern=v{{version}},priority=900
type=sha,priority=890
type=ref,event=branch,priority=600
type=ref,event=pr,priority=600
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }},priority=200
- name: 📦 Build and push Docker image
uses: https://git.devthefuture.org/devthefuture/actions/buildkit@v0.0.1
with:
context: ${{ inputs.context }}
file: ${{ inputs.dockerfile }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
registry: git.devthefuture.org
registry-username: "org-bot-${{ github.repository_owner }}"
registry-password: ${{ secrets.M8A_ORG_BOT_PACKAGE_TOKEN }}