Skip to content

feat(ci): update docker/login-action #290

feat(ci): update docker/login-action

feat(ci): update docker/login-action #290

# EVENTS: push, schedule, workflow_dispatch
# workflow_dispatch: Build all. No publish to registry; save as tarball.
# schedule: Build only devel and prebuilt. TAGS: date, latest
# push-branch: Build only devel and prebuilt. TAGS: date, latest
# push-tag: Build all. TAGS: version, date, latest
name: docker-build-and-push-main
on:
pull_request:
workflow_dispatch:
inputs:
artifacts-destination:
type: choice
description: Destination for the artifacts
options:
- registry
- tarball
default: tarball
jobs:
load-env:
uses: ./.github/workflows/load-env.yaml
docker-build-and-push-main:
needs: load-env
runs-on: buildjet-16vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
name:
- no-cuda
- cuda
include:
- name: no-cuda
platform: amd64
base_image_env: base_image
lib_dir: x86_64
setup-args: --no-nvidia
additional-tag-suffix: ""
- name: cuda
platform: amd64
base_image_env: base_image
lib_dir: x86_64
additional-tag-suffix: -cuda
steps:
- name: Check if PR author is the specific user
id: author-check
run: |
PR_AUTHOR=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
if [[ "$PR_AUTHOR" == "youtalk" ]]; then
echo "$PR_AUTHOR is a target user"
echo "author-found=true" >> $GITHUB_OUTPUT
else
echo "$PR_AUTHOR is not a target user"
echo "author-found=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
root-ccache
key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }}
restore-keys: |
cache-${{ matrix.platform }}-${{ matrix.name }}-
cache-${{ matrix.platform }}-
- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.1
with:
cache-map: |
{
"root-ccache": "/root/.ccache"
}
skip-extraction: true
- name: Build 'Autoware'
if: steps.author-check.outputs.author-found == 'true' || ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/actions/docker-build-and-push
with:
bake-target: autoware
build-args: |
*.platform=linux/${{ matrix.platform }}
*.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }}
*.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }}
*.args.SETUP_ARGS=${{ matrix.setup-args }}
*.args.LIB_DIR=${{ matrix.lib_dir }}
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }}
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-main
*.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }},mode=max
tag-suffix: ${{ matrix.additional-tag-suffix }}-${{ matrix.platform }}
tag-prefix: ${{ needs.load-env.outputs.rosdistro }}
allow-push: true
- name: Show disk space
run: |
df -h