-
Notifications
You must be signed in to change notification settings - Fork 196
48 lines (45 loc) · 1.41 KB
/
docker-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Build Tutorial Image
on:
workflow_call:
workflow_dispatch:
jobs:
build-images:
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [humble, rolling]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
GH_IMAGE: ghcr.io/${{ github.repository }}:${{ matrix.ROS_DISTRO }}
PUSH: ${{ (github.ref_name == 'main') }}
steps:
- name: Checkout branch ${{ matrix.ROS_DISTRO == 'rolling' && 'main' || matrix.ROS_DISTRO }}
uses: actions/checkout@v4
with:
ref: ${{ matrix.ROS_DISTRO == 'rolling' && 'main' || matrix.ROS_DISTRO }}
- name: Set lower case for container name
run: |
echo "GH_IMAGE_LC=${GH_IMAGE,,}" >>${GITHUB_ENV}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Tutorial Image
uses: docker/build-push-action@v5
with:
file: .docker/Dockerfile
context: .
build-args: |
ROS_DISTRO=${{ matrix.ROS_DISTRO }}
target: tutorial_image
push: ${{ env.PUSH }}
no-cache: false
tags: |
${{ env.GH_IMAGE_LC }}-tutorial