name: docker
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
ref:
description: 'git ref to build (e.g. v1.4.1; empty = current branch)'
required: false
default: ''
env:
IMAGE: ghcr.io/${{ github.repository }}
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { arch: amd64, runner: ubuntu-24.04 }
- { arch: arm64, runner: ubuntu-24.04-arm }
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref || github.ref }}
- uses: dtolnay/rust-toolchain@stable
- name: install webkit deps
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev
- run: cargo build --release
- name: prepare build context
run: |
cp target/release/navette docker/navette
REF="${{ github.event.inputs.ref || github.ref_name }}"
VERSION="${REF#v}"
case "$VERSION" in *.*.*) ;; *) VERSION="edge" ;; esac
echo "IMAGE_TAG=$VERSION" >> "$GITHUB_ENV"
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/build-push-action@v6
with:
context: ./docker
platforms: linux/${{ matrix.arch }}
push: true
tags: ${{ env.IMAGE }}:${{ env.IMAGE_TAG }}-${{ matrix.arch }}
manifest:
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: create and push the multi-arch manifest
run: |
REF="${{ github.event.inputs.ref || github.ref_name }}"
VERSION="${REF#v}"
case "$VERSION" in *.*.*) ;; *) VERSION="edge" ;; esac
docker manifest create "$IMAGE:$VERSION" \
--amend "$IMAGE:$VERSION-amd64" \
--amend "$IMAGE:$VERSION-arm64"
docker manifest push "$IMAGE:$VERSION"
docker manifest create "$IMAGE:latest" \
--amend "$IMAGE:$VERSION-amd64" \
--amend "$IMAGE:$VERSION-arm64"
docker manifest push "$IMAGE:latest"