The builder stage cross-compiles Caddy for the target platform, so no emulation is needed. The module check runs against the amd64 image; PR checks also build arm64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
schedule:
|
|
# Weekly, so new Caddy and caddy-dns/desec releases land without a commit.
|
|
- cron: "17 4 * * 1"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: docker:cli
|
|
env:
|
|
IMAGE: code.aneur.in/${{ gitea.repository }}
|
|
steps:
|
|
- name: Install Node (for checkout)
|
|
run: apk add --no-cache nodejs
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker buildx
|
|
run: |
|
|
docker buildx rm multi 2>/dev/null || true
|
|
docker buildx create --name multi --driver docker-container --use
|
|
|
|
- name: Build
|
|
run: docker buildx build --pull --platform linux/amd64 --tag "$IMAGE:check" --load .
|
|
|
|
- name: Check the deSEC module is built in
|
|
run: docker run --rm "$IMAGE:check" caddy list-modules | grep -x dns.providers.desec
|
|
|
|
- name: Log in to the container registry
|
|
env:
|
|
BUILD_API_TOKEN: ${{ secrets.BUILD_API_TOKEN }}
|
|
run: echo "$BUILD_API_TOKEN" | docker login code.aneur.in -u "${{ gitea.actor }}" --password-stdin
|
|
|
|
- name: Promote current "latest" to "previous"
|
|
run: |
|
|
if docker buildx imagetools inspect "$IMAGE:latest" >/dev/null 2>&1; then
|
|
docker buildx imagetools create -t "$IMAGE:previous" "$IMAGE:latest"
|
|
else
|
|
echo "No existing :latest to promote; skipping."
|
|
fi
|
|
|
|
- name: Build and push multi-arch "latest"
|
|
run: |
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--tag "$IMAGE:latest" \
|
|
--push \
|
|
.
|