builder/.forgejo/workflows/build.yaml

44 lines
1.5 KiB
YAML
Raw Normal View History

2024-07-15 22:05:19 +02:00
on: [push]
env:
2025-05-16 17:42:27 +02:00
REGISTRY: forge.hornwitser.no
2025-05-17 21:23:19 +02:00
REGISTRY_IMAGE: forge.hornwitser.no/hornwitser/builder:${{ github.ref_name }}
2024-07-15 22:05:19 +02:00
jobs:
build:
2025-05-17 21:01:50 +02:00
runs-on: debian
2024-07-15 22:05:19 +02:00
steps:
-
2025-05-17 21:01:50 +02:00
name: Install and configure dependencies
run: |
2025-05-17 21:02:57 +02:00
apt-get update
2025-05-17 21:07:53 +02:00
apt-get install -y --no-install-recommends \
buildah \
ca-certificates \
containers-storage \
2025-05-17 22:55:09 +02:00
crun \
2025-05-17 21:07:53 +02:00
git \
2025-05-17 21:15:55 +02:00
netavark \
2025-05-17 21:07:53 +02:00
;
shared=/var/lib/shared/storage
2025-05-17 21:01:50 +02:00
sed /usr/share/containers/storage.conf \
2025-05-18 16:30:39 +02:00
-e "/^additionalimagestores/a"'\
'"\"$shared\"" \
2025-05-17 21:01:50 +02:00
> /etc/containers/storage.conf
2024-07-15 22:05:19 +02:00
-
2025-05-16 18:53:29 +02:00
name: Checkout repository
run: |
2025-05-16 19:08:29 +02:00
git config --global credential.helper store
echo "https://runner:${{ secrets.GITHUB_TOKEN }}@$(echo "${{ github.server_url }}" | cut -b 9-)" > ~/.git-credentials
2025-05-16 18:53:29 +02:00
git clone --branch ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }} ${{ github.workspace }}
2025-05-16 17:42:27 +02:00
-
name: Authenticate with registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | buildah login ${{ env.REGISTRY }} --username runner --password-stdin
2024-07-15 22:05:19 +02:00
-
2025-05-16 17:50:14 +02:00
name: Build and push
run: |
2025-05-17 21:46:54 +02:00
export BUILDAH_ISOLATION=chroot
2025-05-17 22:18:27 +02:00
export _BUILDAH_STARTED_IN_USERNS=""
2025-05-17 21:36:06 +02:00
${{ github.workspace }}/builder.sh ${{ env.REGISTRY_IMAGE }}
2025-05-16 17:50:14 +02:00
buildah push ${{ env.REGISTRY_IMAGE }}