lldap-controller/.gitea/workflows/build.yaml
Dreaded_X be463a2060
Some checks failed
Build and deploy / Build container (push) Failing after 4m58s
Build and deploy / Publish manifests (push) Successful in 35s
WIP: Improve actions
2025-03-20 02:41:34 +01:00

103 lines
3.1 KiB
YAML

name: Build and deploy
on:
push:
branches:
- master
- feature/**
tags:
- v*.*.*
jobs:
build:
name: Build container
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to registry
uses: docker/login-action@v3
with:
registry: git.huizinga.dev
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name}}
tags: |
type=edge
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
id: build
uses: docker/build-push-action@v6
with:
context: .
push: true
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Testing 1
run: |
echo ${{ steps.build.outputs.imageid }}
echo ${{ steps.build.outputs.digest }}
- name: Testing 2
run: |
docker image inspect git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}@${{ steps.build.outputs.digest }}
- name: Generate CRDs
run: |
docker run --rm git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}@${{ steps.build.outputs.digest }} crdgen > ./crds.yaml
cat ./crds.yaml
manifests:
name: Publish manifests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install kustomize
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
- name: Setup Flux CLI
uses: https://github.com/fluxcd/flux2/action@main
with:
version: v2.5.0
- name: Login to registry
uses: docker/login-action@v3
with:
registry: git.huizinga.dev
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
# TODO: Generate and include crds
- name: Generate manifets
run: |
./kustomize build ./manifests | sed "s/\${SHA_SHORT}/$(git rev-parse --short HEAD)/" > ./app.yaml
- name: Push manifests
run: |
flux push artifact oci://git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}/manifests:sha-$(git rev-parse --short HEAD) \
--path="./app.yaml" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)"
- name: Tag manifests
run: |
flux tag artifact oci://git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}/manifests:sha-$(git rev-parse --short HEAD) \
--tag edge