Skip to content

chore: Replace oneof bool to bool for default false options (#5541) #18

chore: Replace oneof bool to bool for default false options (#5541)

chore: Replace oneof bool to bool for default false options (#5541) #18

Workflow file for this run

name: Publish Docker image
on:
push:
branches:
- "master"
tags:
- "*"
paths-ignore:
- ".circleci"
- ".github"
- "!.github/workflows/docker-build.yml"
- ".gitignore"
- "**.md"
- "test/"
- "test_requests/"
- "docs/"
- "**vcpkg**"
- "run_route_scripts/"
- ".*"
- "pyproject.toml"
- "setup.cfg"
- "setup.py"
- "taginfo.json"
jobs:
build_and_publish:
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux/amd64
tagsuffix: amd64
- os: ubuntu-24.04-arm
platform: linux/arm64
tagsuffix: arm64
outputs:
tag: ${{ steps.extract_tag.outputs.tag }}
if: ${{ github.repository_owner == 'valhalla' }}
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-depth: 0
- name: Extract tag name
if: startsWith(github.ref, 'refs/tags/')
run: echo "##[set-output name=tag;]${GITHUB_REF#refs/tags/}"
id: extract_tag
- name: Get version modifier
if: github.ref == 'refs/heads/master'
run: echo "version_modifier=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: extract_gitsha
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# the following has to be done sequentially so the "base" image is available
# for the "scripted" image
- name: Build and push latest - plain image
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
provenance: false # needed to be able to converge into one image
platforms: ${{ matrix.platform }}
push: true
tags: ghcr.io/valhalla/valhalla:latest-${{ matrix.tagsuffix }}
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
build-args: |
VERSION_MODIFIER=${{ steps.extract_gitsha.outputs.version_modifier }}
- name: Build and push latest - scripted image
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile-scripted
provenance: false # needed to be able to converge into one image
platforms: ${{ matrix.platform }}
push: true
tags: ghcr.io/valhalla/valhalla-scripted:latest-${{ matrix.tagsuffix }}
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
build-args: |
VERSION_MODIFIER=${{ steps.extract_gitsha.outputs.version_modifier }}
VALHALLA_BUILDER_IMAGE=ghcr.io/valhalla/valhalla:latest-${{ matrix.tagsuffix }}
- name: Build and push tag - plain image
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
provenance: false # needed to be able to converge into one image
platforms: ${{ matrix.platform }}
push: true
tags: ghcr.io/valhalla/valhalla:${{ steps.extract_tag.outputs.tag }}-${{ matrix.tagsuffix }}
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
- name: Build and push tag - scripted image
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile-scripted
provenance: false # needed to be able to converge into one image
platforms: ${{ matrix.platform }}
push: true
tags: ghcr.io/valhalla/valhalla-scripted:${{ steps.extract_tag.outputs.tag }}-${{ matrix.tagsuffix }}
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
build-args: |
VALHALLA_BUILDER_IMAGE=ghcr.io/valhalla/valhalla:${{ steps.extract_tag.outputs.tag }}-${{ matrix.tagsuffix }}
create-manifests:
strategy:
matrix:
include:
- image: valhalla
- image: valhalla-scripted
runs-on: ubuntu-latest
needs: [build_and_publish]
steps:
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push tag manifest
if: startsWith(github.ref, 'refs/tags/')
run: |
docker manifest create \
ghcr.io/valhalla/${{ matrix.image }}:${{ needs.build_and_publish.outputs.tag }} \
--amend ghcr.io/valhalla/${{ matrix.image }}:${{ needs.build_and_publish.outputs.tag }}-amd64 \
--amend ghcr.io/valhalla/${{ matrix.image }}:${{ needs.build_and_publish.outputs.tag }}-arm64
docker manifest push ghcr.io/valhalla/${{ matrix.image }}:${{ needs.build_and_publish.outputs.tag }}
- name: Create and push latest manifest
if: github.ref == 'refs/heads/master'
run: |
docker manifest create \
ghcr.io/valhalla/${{ matrix.image }}:latest \
--amend ghcr.io/valhalla/${{ matrix.image }}:latest-amd64 \
--amend ghcr.io/valhalla/${{ matrix.image }}:latest-arm64
docker manifest push ghcr.io/valhalla/${{ matrix.image }}:latest
test-image:
if: github.ref == 'refs/heads/master'
strategy:
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
needs: [create-manifests]
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: ""
fetch-depth: 1
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Test latest scripted image
run: |
docker pull ghcr.io/valhalla/valhalla-scripted:test
sudo apt-get update > /dev/null
sudo apt-get install -y moreutils tree > /dev/null
sudo /bin/bash -c "./docker/test.sh ghcr.io/valhalla/valhalla-scripted:test"