This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/cache](https://github.com/actions/cache) | action | pinDigest | -> `0057852` | | [actions/checkout](https://github.com/actions/checkout) | action | pinDigest | -> `8e8c483` | | [actions/setup-go](https://github.com/actions/setup-go) | action | pinDigest | -> `4dc6199` | | [docker/build-push-action](https://github.com/docker/build-push-action) | action | pinDigest | -> `2634353` | | [docker/login-action](https://github.com/docker/login-action) | action | pinDigest | -> `5e57cd1` | | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | action | pinDigest | -> `e468171` | | gcr.io/distroless/static-debian12 | final | pinDigest | -> `4b2a093` | | golang | stage | pinDigest | -> `2611181` | | [https://gitea.com/actions/go-hashfiles](https://gitea.com/actions/go-hashfiles) | action | pinDigest | -> `264ae76` | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4zNy4xIiwidXBkYXRlZEluVmVyIjoiNDIuMzcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiYWN0aW9uIiwiZGVwcyJdfQ==--> Reviewed-on: #62 Reviewed-by: t.behrendt <t.behrendt@noreply.localhost> Co-authored-by: Renovate Bot <renovate@t00n.de> Co-committed-by: Renovate Bot <renovate@t00n.de>
142 lines
4.7 KiB
YAML
142 lines
4.7 KiB
YAML
name: CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "go.mod"
|
|
- "go.sum"
|
|
- "**/*.go"
|
|
- "config.example.yaml"
|
|
- "Dockerfile"
|
|
- "Makefile"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DOCKER_REGISTRY: gitea.t000-n.de
|
|
|
|
jobs:
|
|
test:
|
|
name: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
|
- name: Setup go
|
|
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
|
|
with:
|
|
go-version-file: go.mod
|
|
check-latest: true
|
|
- name: Create cache key
|
|
uses: https://gitea.com/actions/go-hashfiles@264ae76b7e50173ce71ed7da4b48e5e517f3f9ec # v0.0.1
|
|
id: hash-go
|
|
with:
|
|
patterns: |
|
|
go.mod
|
|
go.sum
|
|
- name: cache go
|
|
id: cache-go
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
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: test
|
|
run: make test
|
|
|
|
build_and_push:
|
|
name: Build and push
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64, arm64]
|
|
needs:
|
|
- test
|
|
runs-on:
|
|
- ubuntu-latest
|
|
- linux_${{ matrix.arch }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
|
|
- name: Login to Registry
|
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
|
|
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@263435318d21b8e681c14492fe198d362a7d2c83 # v6
|
|
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@0.1.20
|
|
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
|
|
|
- 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@5e57cd118135c172c3672efd75eb46360885c0ef # v3
|
|
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 \
|
|
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-arm64
|
|
|
|
docker manifest push ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ needs.create_tag.outputs.tag }}
|