feat: adjust sample to mvp (#1)
CD / Create tag (push) Successful in 12s
CD / Build and push (amd64) (push) Successful in 1m38s
CD / Create manifest (push) Successful in 7s

Reviewed-on: #1
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
This commit was merged in pull request #1.
This commit is contained in:
2026-05-17 14:39:46 +02:00
committed by t.behrendt
parent efe2b34116
commit bc8e7e10e1
54 changed files with 6697 additions and 24 deletions
+104
View File
@@ -0,0 +1,104 @@
name: CD
on:
push:
branches:
- main
paths:
- "go.mod"
- "go.sum"
- "**/*.go"
- "Dockerfile"
- "Makefile"
workflow_dispatch:
env:
DOCKER_REGISTRY: gitea.t000-n.de
jobs:
build_and_push:
name: Build and push
strategy:
matrix:
arch: [amd64]
runs-on:
- ubuntu-latest
- linux_${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Get Metadata
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
context: .
file: ./Dockerfile
platforms: linux/${{ matrix.arch }}
push: true
provenance: false
build-args: GOARCH=${{ matrix.arch }}
tags: |
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-${{ matrix.arch }}
create_tag:
name: Create tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.new-tag }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@ef0c23189db33220a73022d8c29a27709d0df440 # 0.1.32
id: tag
with:
token: ${{ secrets.GITEA_TOKEN }}
prerelease: ${{ github.event_name == 'workflow_dispatch' }}
- run: |
git tag ${{ steps.tag.outputs.new-tag }}
git push origin ${{ steps.tag.outputs.new-tag }}
- name: Set output
run: |
echo "tag=${{ steps.tag.outputs.new-tag }}" >> $GITHUB_OUTPUT
create_manifest:
name: Create manifest
needs:
- build_and_push
- create_tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get Metadata
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Login to Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Create manifest
run: |
docker manifest create ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ needs.create_tag.outputs.tag }} \
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-amd64
docker manifest push ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ needs.create_tag.outputs.tag }}
+34 -20
View File
@@ -8,30 +8,44 @@ env:
RUNNER_TOOL_CACHE: /toolcache
jobs:
install-dependencies:
uses: ./.gitea/workflows/install-go-dependencies.yaml
build-check:
name: build check
needs: install-dependencies
uses: ./.gitea/workflows/run-go-script.yaml
with:
script: build
check-format:
name: check format
needs: install-dependencies
uses: ./.gitea/workflows/run-go-script.yaml
with:
script: check-format
check-lint:
name: check lint
needs: install-dependencies
uses: ./.gitea/workflows/run-go-script.yaml
with:
script: lint
test:
name: test
needs: install-dependencies
uses: ./.gitea/workflows/run-go-script.yaml
with:
script: test
image-check:
name: image check
runs-on:
- ubuntu-latest
- linux_amd64
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version-file: go.mod
check-latest: true
- name: Create cache key
id: hash-go
run: echo "hash=$(sha256sum go.mod go.sum | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: cache go
id: cache-go
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.hash-go.outputs.hash }}
restore-keys: |-
go_cache-${{ steps.hash-go.outputs.hash }}
- name: build
run: make build
- name: Build image
run: make build-image
@@ -0,0 +1,33 @@
name: Install Go Dependencies
on:
workflow_call:
jobs:
install-dependencies:
runs-on:
- ubuntu-latest
- linux_amd64
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
check-latest: true
- name: Create cache key
id: go-cache-key
uses: ./.gitea/actions/go-cache-key
- name: cache go
id: cache-go
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.go-cache-key.outputs.hash }}
restore-keys: |-
go_cache-${{ steps.go-cache-key.outputs.hash }}
- name: Download dependencies
run: go mod download
+38
View File
@@ -0,0 +1,38 @@
name: Run Go Script
on:
workflow_call:
inputs:
script:
description: The script to run
required: true
type: string
jobs:
run-script:
runs-on:
- ubuntu-latest
- linux_amd64
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
check-latest: true
- name: Create cache key
id: go-cache-key
uses: ./.gitea/actions/go-cache-key
- name: Install dependencies from Cache
id: cache-go
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.go-cache-key.outputs.hash }}
restore-keys: |-
go_cache-${{ steps.go-cache-key.outputs.hash }}
- name: Run script
run: make ${{ inputs.script }}