-
Notifications
You must be signed in to change notification settings - Fork 4
88 lines (87 loc) · 2.79 KB
/
pbuilder-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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build and upload pbuilder images to Docker hub
on:
schedule:
- cron: '0 22 * * *'
push:
paths:
- '.github/workflows/pbuilder-images.yml'
- 'docker/**'
jobs:
build:
strategy:
fail-fast: false
matrix:
dist: [xenial, bionic, focal, jammy, noble, oracular]
arch: [i386, amd64]
exclude:
# No more i386 support since focal
- dist: focal
arch: i386
- dist: jammy
arch: i386
- dist: noble
arch: i386
- dist: oracular
arch: i386
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build image
run: |
set -x
export TAG="${{ matrix.dist }}-${{ matrix.arch }}"
echo "::group::Login to Docker Hub"
cd docker
docker login -u ${{ secrets.DOCKER_HUB_USER }} -p ${{ secrets.DOCKER_HUB_PWD }}
echo "::endgroup::"
echo "::group::Declare function"
build-image()
{
if [ -f Dockerfile.${{ matrix.dist }} ]
then
cp Dockerfile.${{ matrix.dist }} Dockerfile
fi
sed -i -e's/@ARCH@/${{ matrix.arch }}/' Dockerfile
sed -i -e's/@DIST@/${{ matrix.dist }}/' Dockerfile
sed -i -e's/@ARCH@/${{ matrix.arch }}/' Dockerfile.ros
sed -i -e's/@DIST@/${{ matrix.dist }}/' Dockerfile.ros
sed -i -e's/@ARCH@/${{ matrix.arch }}/' Dockerfile.ros2
sed -i -e's/@DIST@/${{ matrix.dist }}/' Dockerfile.ros2
export ROS_DISTRO=$1
export ROS2_DISTRO=$2
export TAG="${{ matrix.dist }}-${{ matrix.arch }}"
if [ ! -z ${ROS_DISTRO} ]; then
sed -i -e "s/@ROS_DISTRO@/${ROS_DISTRO}/" Dockerfile.ros
export TAG="${TAG}-${ROS_DISTRO}"
cp Dockerfile.ros Dockerfile
fi
if [ ! -z ${ROS2_DISTRO} ]; then
sed -i -e "s/@ROS_DISTRO@/${ROS2_DISTRO}/" Dockerfile.ros2
export TAG="${TAG}-${ROS2_DISTRO}"
cp Dockerfile.ros2 Dockerfile
fi
echo "::group::Build image"
docker build -t gergondet/pbuilder:${TAG} .
echo "::endgroup::"
echo "::group::Upload image"
docker image push gergondet/pbuilder:${TAG}
echo "::endgroup::"
}
echo "::endgroup::"
build-image "" ""
if [ "${{ matrix.dist }}" = "xenial" ]
then
build-image "kinetic" ""
fi
if [ "${{ matrix.dist }}" = "bionic" -a "${{ matrix.arch }}" = "amd64" ]
then
build-image "melodic" ""
fi
if [ "${{ matrix.dist }}" = "focal" ]
then
build-image "noetic" ""
fi
if [ "${{ matrix.dist }}" = "jammy" ]
then
build-image "" "humble"
fi