From 590a9a5d781dab85bae280c637789d077684f08a Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Mon, 7 Aug 2023 11:25:07 +0200 Subject: [PATCH] feat(CI): Add pipeline to build images --- .gitea/workflows/builder.yaml | 23 +++++++++++++++++++++++ build.sh | 16 ++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .gitea/workflows/builder.yaml create mode 100755 build.sh diff --git a/.gitea/workflows/builder.yaml b/.gitea/workflows/builder.yaml new file mode 100644 index 0000000..cdefcb2 --- /dev/null +++ b/.gitea/workflows/builder.yaml @@ -0,0 +1,23 @@ +name: Image builder +on: + release: + types: [released] + push: + +jobs: + build: + container: + image: git.halis.io/athens-school/runner-images:debian12.1-node18 + runs-on: [arm64] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Login to register + uses: https://gitea.com/docker/login-action@v2 + with: + registry: https://git.halis.io + username: ${{ github.actor }} + password: ${{ secrets.CONTAINER_TOKEN }} + - name: Start shell build + run: ./build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..58686c2 --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +IMAGE_NAME=$(echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]' | cut -d '/' -f3-) + +for d in ./images/* +do + for i in $d/* + do + echo "Building $i" + DISTRO=$(echo $i | cut -d '/' -f 3) + VERSION=$(echo $i | cut -d '/' -f 4 | cut -d '.' -f2-) + + docker build -f $i . -t $IMAGE_NAME:$DISTRO$VERSION + docker push $IMAGE_NAME:$DISTRO$VERSION + done +done