Use reusable workflow
All checks were successful
Build and deploy / build (push) Successful in 6m36s
All checks were successful
Build and deploy / build (push) Successful in 6m36s
This commit is contained in:
parent
3b439f15e2
commit
277f7441dc
|
@ -7,87 +7,9 @@ on:
|
||||||
tags:
|
tags:
|
||||||
- v*.*.*
|
- v*.*.*
|
||||||
|
|
||||||
env:
|
|
||||||
OCI_REPO: git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name}}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build container and manifests
|
uses: dreaded_x/workflows/.gitea/workflows/rust-kubernetes.yaml@eb5e53197b9b56786a56f99413817d50caba99be
|
||||||
runs-on: ubuntu-latest
|
secrets: inherit
|
||||||
steps:
|
with:
|
||||||
- name: Checkout
|
generate_crds: true
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set timestamp and release version
|
|
||||||
run: |
|
|
||||||
echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
|
|
||||||
git fetch --prune --unshallow --tags --force
|
|
||||||
echo "RELEASE_VERSION=$(git describe --always --dirty='--modified')" >> $GITHUB_ENV
|
|
||||||
cat $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Login to registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: git.huizinga.dev
|
|
||||||
username: ${{ gitea.actor }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- 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: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.OCI_REPO }}
|
|
||||||
tags: |
|
|
||||||
type=edge
|
|
||||||
type=ref,event=branch
|
|
||||||
type=semver,pattern=v{{version}}
|
|
||||||
type=semver,pattern=v{{major}}.{{minor}}
|
|
||||||
type=semver,pattern=v{{major}}
|
|
||||||
|
|
||||||
- name: Build container
|
|
||||||
id: build
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
sbom: true
|
|
||||||
provenance: mode=max
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
annotations: ${{ steps.meta.outputs.annotations }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
build-args: |
|
|
||||||
"RELEASE_VERSION=${{ env.RELEASE_VERSION }}"
|
|
||||||
env:
|
|
||||||
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
|
||||||
|
|
||||||
- name: Generate CRDs
|
|
||||||
run: |
|
|
||||||
docker run --rm ${{ env.OCI_REPO }}@${{ steps.build.outputs.imageid }} /crdgen > ./manifests/crds.yaml
|
|
||||||
|
|
||||||
- name: Kustomize manifests
|
|
||||||
run: |
|
|
||||||
./kustomize build ./manifests | sed "s/\${DIGEST}/${{ steps.build.outputs.digest }}/" > ./manifests.yaml
|
|
||||||
|
|
||||||
- name: Push manifests
|
|
||||||
run: |
|
|
||||||
flux push artifact oci://${{ env.OCI_REPO }}/manifests:${{ gitea.head_ref || gitea.ref_name }} \
|
|
||||||
--path="./manifests.yaml" \
|
|
||||||
--source="$(git config --get remote.origin.url)" \
|
|
||||||
--revision="$(git rev-parse HEAD)" \
|
|
||||||
$(echo "${{ steps.meta.outputs.labels }}" | sed -e 's/^/-a /')
|
|
||||||
|
|
||||||
flux tag artifact oci://${{ env.OCI_REPO }}/manifests:${{ gitea.head_ref || gitea.ref_name }} \
|
|
||||||
$(echo "${{ steps.meta.outputs.tags }}" | sed -e 's/^.*:/--tag /')
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user