Skip to content

Build and publish images #26

Build and publish images

Build and publish images #26

name: Build and publish images
on:
workflow_dispatch:
release:
types: [published]
env:
IMAGE_REF_NAME: ${{ github.event_name == 'release' && 'robothub-app-v2' || 'robothub-app-v2-dev' }}
jobs:
generate-version:
name: Generate image version
runs-on: buildjet-2vcpu-ubuntu-2204
outputs:
version: ${{ steps.generate-version.outputs.version }}
steps:
- name: Generate image version
id: generate-version
run: echo "version=$(date +%Y.%j.%H%M)" >> "$GITHUB_OUTPUT"
build:
name: Build & push images
permissions:
packages: write
contents: read
needs: generate-version
strategy:
fail-fast: false
matrix:
runner:
- { runs-on: buildjet-4vcpu-ubuntu-2204, arch: amd64 }
- { runs-on: buildjet-4vcpu-ubuntu-2204-arm, arch: arm64 }
env:
IMAGE_VERSION: ${{ needs.generate-version.outputs.version }}
ARCH: ${{ matrix.runner.arch }}
runs-on: ${{ matrix.runner.runs-on }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push images
run: ./scripts/build-images.sh
make-manifests:
name: Make multi-arch manifests
permissions:
packages: write
contents: read
needs: [generate-version, build]
env:
IMAGE_VERSION: ${{ needs.generate-version.outputs.version }}
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Make multi-arch manifests
run: ./scripts/make-manifests.sh