9 Commits

Author SHA1 Message Date
34662a99cd infra: image: switch to using ${{ vars.REGISTRY_URL }}
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 5m9s
Gentoo Utils / build (push) Successful in 1m33s
Doing this so I can change this site wide in the future without anything breaking
2025-12-08 20:47:12 -06:00
d2ce6bc8ff infra: image: fixes image_tag 2025-12-08 20:47:12 -06:00
91dcd3b3fb infra: image: fix image tag for build job 2025-12-08 20:47:12 -06:00
e9386ad64a infra: image: build image for branches if they dont exist 2025-12-08 20:47:12 -06:00
c288787d91 infra: image: fixes c35db0f 2025-12-08 20:47:12 -06:00
df10b0fac0 infra: image: protect :latest tag so only the default branch can push to it
infra: image: fix hard coded image name
2025-12-08 20:47:12 -06:00
407b836c77 infra: image: create entrypoint script and put env sources in it 2025-12-08 20:47:12 -06:00
2c8a6c3783 infra: simplify pipeline logic 2025-12-08 20:47:10 -06:00
e06415fb7b run CI when pushing to any branch
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 8s
Gentoo Utils / build (push) Successful in 31s
2025-12-08 22:24:12 +00:00
3 changed files with 42 additions and 17 deletions

View File

@@ -31,4 +31,6 @@ USER gentooligan
WORKDIR /workspace
ENTRYPOINT /bin/bash
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/bin/bash"]

6
.docker/entrypoint.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
source /etc/profile
source /lib/gentoo/functions.sh
exec "$@"

View File

@@ -1,10 +1,6 @@
name: Gentoo Utils
on:
push:
branches: [master]
pull_request:
branches: [master]
on: [push]
jobs:
build-oci-image:
@@ -18,39 +14,60 @@ jobs:
- name: Check for changes before building
id: image-changes
# build image only if 1. changes are detected or 2. an image for the working branch doesnt exist
run: |
echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITEA_OUTPUT
if ! git diff ${{ gitea.event.before }} ${{ gitea.sha }} --no-patch --exit-code .docker; then
echo changes_detected=true >> $GITEA_OUTPUT
branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
if [[ "$branch_name" == "${{ gitea.event.repository.default_branch }}" ]]; then
image_tag=latest
else
echo changes_detected=false >> $GITEA_OUTPUT
image_tag=$branch_name
fi
echo "branch_name=$branch_name" >> $GITEA_OUTPUT
# slugify
image_tag="$(echo "$image_tag" | sed -E 's/[^a-zA-Z0-9]/-/g')"
echo "image_tag=$image_tag" >> $GITEA_OUTPUT
if ! git diff ${{ gitea.event.before }} ${{ gitea.sha }} --no-patch --exit-code .docker; then
build_image=true
else
if ! docker manifest inspect ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${image_tag} >/dev/null 2>&1; then
build_image=true
else
build_image=false
fi
fi
echo "build_image=$build_image" >> $GITEA_OUTPUT
cat $GITEA_OUTPUT
- name: Set up Docker buildx
if: steps.image-changes.outputs.changes_detected == 'true'
if: steps.image-changes.outputs.build_image == 'true'
uses: docker/setup-buildx-action@v3
- name: Log in to Github Container Registry
if: steps.image-changes.outputs.changes_detected == 'true'
if: steps.image-changes.outputs.build_image == 'true'
uses: docker/login-action@v3
with:
registry: git.epenguin.net
registry: ${{ vars.REGISTRY_URL }}
username: ${{ vars.CI_BOT_USERNAME }}
password: ${{ secrets.CI_BOT_TOKEN }}
- name: Build and push
if: steps.image-changes.outputs.changes_detected == 'true'
if: steps.image-changes.outputs.build_image == 'true'
uses: docker/build-push-action@v6
with:
push: true
tags: git.epenguin.net/${{ gitea.repository }}:latest
tags: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ steps.image-changes.outputs.image_tag }}
context: "{{defaultContext}}:.docker"
outputs:
image_tag: ${{ steps.image-changes.outputs.image_tag }}
build:
runs-on: brutalisk
container:
image: git.epenguin.net/gentoo-utils/gentoo-utils-gitea:latest
needs: build-oci-image
container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v5