Tobias Genannt a24c19c503 Use Docker Build Cloud for releases
With QEMU the ARM64 builds are slow and not reliable. If we use the
Docker Cloud builders we reduce the build times considerably.
As a Docker OSS organisation we get 400 build minutes per month, which
should be fine, because we already use checks if builds are really
needed. The Docker Cloud also uses a cache that should reduce build
times a little bit more.
2024-09-04 10:17:05 +02:00

84 lines
2.5 KiB
YAML

---
name: release
on:
release:
types:
- published
schedule:
- cron: "45 5 * * *"
workflow_dispatch:
jobs:
build:
strategy:
matrix:
build_cmd:
- ./build-latest.sh
- PRERELEASE=true ./build-latest.sh
- ./build.sh feature
- ./build.sh develop
platform:
- linux/amd64,linux/arm64
fail-fast: false
runs-on: ubuntu-latest
name: Builds new NetBox Docker Images
env:
GH_ACTION: enable
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAMES: docker.io/netboxcommunity/netbox quay.io/netboxcommunity/netbox ghcr.io/netbox-community/netbox
steps:
- id: source-checkout
name: Checkout
uses: actions/checkout@v4
- id: set-netbox-docker-version
name: Get Version of NetBox Docker
run: echo "version=$(cat VERSION)" >>"$GITHUB_OUTPUT"
shell: bash
- id: check-build-needed
name: Check if the build is needed for '${{ matrix.build_cmd }}'
env:
CHECK_ONLY: "true"
run: ${{ matrix.build_cmd }}
# docker.io
- id: docker-io-login
name: Login to docker.io
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_password }}
if: steps.check-build-needed.outputs.skipped != 'true'
- id: buildx-setup
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: "lab:latest"
driver: cloud
endpoint: "netboxcommunity/netbox-default"
# quay.io
- id: quay-io-login
name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.quayio_username }}
password: ${{ secrets.quayio_password }}
if: steps.check-build-needed.outputs.skipped != 'true'
# ghcr.io
- id: ghcr-io-login
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: steps.check-build-needed.outputs.skipped != 'true'
- id: build-and-push
name: Push the image
run: ${{ matrix.build_cmd }} --push
if: steps.check-build-needed.outputs.skipped != 'true'
env:
BUILDX_PLATFORM: ${{ matrix.platform }}
BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}