-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (88 loc) · 3.34 KB
/
build-ros-debian.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
89
90
91
92
93
94
95
96
97
98
99
#
# Copyright (c) 2024, Auterion AG
# All rights reserved.
#
name: Build and publish debian package for ROS package
on:
workflow_call:
inputs:
platform:
type: string
description: 'Platform to build for (e.g. linux/amd64 or linux/arm64)'
required: true
ubuntu-distro:
type: string
description: 'Ubuntu distribution to build for (e.g. focal)'
required: true
ros2-distro:
type: string
description: 'ROS distribution to build for (e.g. humble)'
required: true
source-prefix:
type: string
description: 'Prefix of the source directory for the package'
default: '.'
runner:
description: "Runner; For example: ubuntu-latest"
required: false
type: string
default: 'ubuntu-latest'
jobs:
build-and-publish:
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Set version in package.xml, if building release
if: ${{ github.event_name == 'release' }}
run: |
SANTIZED_VERSION=$(echo ${{ github.event.release.tag_name }} | sed 's/-/\~/g')
sed -i "s/<version>.*<\/version>/<version>$SANTIZED_VERSION<\/version>/" ${{ inputs.source-prefix }}/package.xml
- name: Checkout workflow repo
uses: actions/checkout@v2
with:
repository: auterion/ros-debian-workflow
path: ros-debian-workflow
- name: Build build environment
working-directory: ros-debian-workflow
run: |
docker build . -f Dockerfile.debian-buildenv \
--platform ${{ inputs.platform }} \
--build-arg="ROS2_DISTRO=${{ inputs.ros2-distro }}" \
--build-arg="UBUNTU_DISTRO=${{ inputs.ubuntu-distro }}" \
-t buildenv:current
- name: Build debian package
run: |
docker run --rm -v $(pwd)/${{ inputs.source-prefix }}:/work --platform ${{ inputs.platform }} buildenv:current
- name: Generate artifact name
run: |
# remove forward slashes from platform name
platform_name="${{ inputs.platform }}"
platform_name="${platform_name//\//-}"
echo "ARTIFACT_NAME=debian-packages_${platform_name}_${{ inputs.ubuntu-distro }}_${{ inputs.ros2-distro }}_${{ inputs.runner }}" >> $GITHUB_ENV
- name: Upload artifacts to github actions/checkout
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ inputs.source-prefix }}/output/*.deb
- name: Generate upload information
run: |
echo "DEBIAN_PACKAGE=$(ls ${{ inputs.source-prefix }}/output/ | grep '\.deb')" >> $GITHUB_ENV
- run: |
echo "DEBIAN PACKAGE FILE: ${{ env.DEBIAN_PACKAGE }}"
- name: Push package to cloudsmith
if: ${{ github.event_name == 'release' }}
uses: cloudsmith-io/action@v0.5.4
with:
api-key: ${{ secrets.AUTERION_CI_CLOUDSMITH_API_KEY }}
command: 'push'
format: 'deb'
owner: auterion
repo: public
distro: ubuntu
release: ${{ inputs.ubuntu-distro }}
file: ${{ inputs.source-prefix }}/output/${{ env.DEBIAN_PACKAGE }}