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

48 lines
1.5 KiB
YAML

name: Build image
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: hetzner
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
github-server-url: https://code.mor.re
- name: Set up QEMU
uses: https://github.com/docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
- name: Set up Docker Buildx
id: buildx
uses: https://github.com/docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
- name: Login to registry
if: github.event_name != 'pull_request'
uses: https://github.com/docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: code.mor.re
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Docker meta
id: meta
uses: https://github.com/docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
with:
flavor: |
latest=false
images: |
code.mor.re/${{ github.repository }}
- name: Build and push
uses: https://github.com/docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}