Version wird jetzt beim Docker-Build per --build-arg injiziert. Release-Workflow leitet sie aus dem Tag-Namen ab, Dev-Workflow nutzt den Short-SHA. Verhindert Version-Mismatch bei Releases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
name: Build Dev Docker Image
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [dev]
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- 'README.md'
|
|
- 'LICENSE'
|
|
|
|
env:
|
|
REGISTRY: git.techniverse.net
|
|
IMAGE: git.techniverse.net/scriptos/stream-recorder
|
|
|
|
jobs:
|
|
build-amd64:
|
|
runs-on: linux-amd64
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Gitea Container Registry
|
|
run: echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" -u "${GITHUB_ACTOR}" --password-stdin
|
|
env:
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push amd64 image
|
|
run: |
|
|
SHORT_SHA="${GITHUB_SHA:0:7}"
|
|
|
|
docker build --pull --platform linux/amd64 \
|
|
--build-arg APP_VERSION="dev-${SHORT_SHA}" \
|
|
-t "${IMAGE}:dev-amd64" \
|
|
-t "${IMAGE}:dev-${GITHUB_SHA}-amd64" \
|
|
.
|
|
docker push "${IMAGE}:dev-amd64"
|
|
docker push "${IMAGE}:dev-${GITHUB_SHA}-amd64"
|
|
|
|
build-arm64:
|
|
runs-on: linux-arm64
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Gitea Container Registry
|
|
run: echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" -u "${GITHUB_ACTOR}" --password-stdin
|
|
env:
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push arm64 image
|
|
run: |
|
|
SHORT_SHA="${GITHUB_SHA:0:7}"
|
|
|
|
docker build --pull --platform linux/arm64 \
|
|
--build-arg APP_VERSION="dev-${SHORT_SHA}" \
|
|
-t "${IMAGE}:dev-arm64" \
|
|
-t "${IMAGE}:dev-${GITHUB_SHA}-arm64" \
|
|
.
|
|
docker push "${IMAGE}:dev-arm64"
|
|
docker push "${IMAGE}:dev-${GITHUB_SHA}-arm64"
|
|
|
|
publish-dev-manifest:
|
|
runs-on: linux-amd64
|
|
needs: [build-amd64, build-arm64]
|
|
steps:
|
|
- name: Login to Gitea Container Registry
|
|
run: echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" -u "${GITHUB_ACTOR}" --password-stdin
|
|
env:
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Publish dev manifests
|
|
run: |
|
|
docker manifest create "${IMAGE}:dev-latest" \
|
|
--amend "${IMAGE}:dev-amd64" \
|
|
--amend "${IMAGE}:dev-arm64"
|
|
docker manifest push "${IMAGE}:dev-latest"
|
|
|
|
docker manifest create "${IMAGE}:dev-${GITHUB_SHA}" \
|
|
--amend "${IMAGE}:dev-${GITHUB_SHA}-amd64" \
|
|
--amend "${IMAGE}:dev-${GITHUB_SHA}-arm64"
|
|
docker manifest push "${IMAGE}:dev-${GITHUB_SHA}"
|