Skip to content

Commit f026a9e

Browse files
committed
add: github build action
1 parent 675e920 commit f026a9e

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

.github/workflows/build-deb.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build and Publish Debian Package
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
env:
10+
DEB_BUILD_OPTIONS: nocheck # or whatever options you need
11+
strategy:
12+
matrix:
13+
distro: [debian-bookworm, debian-bullseye, ubuntu-24.04, ubuntu-22.04]
14+
include:
15+
- distro: debian-bookworm
16+
image: debian:bookworm
17+
os: debian
18+
version: bookworm
19+
- distro: debian-bullseye
20+
image: debian:bullseye
21+
os: debian
22+
version: bullseye
23+
- distro: ubuntu-24.04
24+
image: ubuntu:24.04
25+
os: ubuntu
26+
version: noble
27+
- distro: ubuntu-22.04
28+
image: ubuntu:22.04
29+
os: ubuntu
30+
version: jammy
31+
container:
32+
image: ${{ matrix.image }}
33+
steps:
34+
- name: Setup dependencies
35+
run: |
36+
apt-get update
37+
apt-get install -y build-essential devscripts debhelper autotools-dev autoconf-archive pkg-config fakeroot sed git tar gzip python3-pip python3-venv curl jq libyaml-cpp-dev
38+
39+
curl -1sLf 'https://dl.cloudsmith.io/basic/robertburger/robotkernel/setup.deb.sh' | bash
40+
apt-get update
41+
apt-get install -y robotkernel-service-helper robotkernel-dev service-provider-process-data-inspection-dev service-provider-memory-inspection-dev
42+
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Mark working directory as safe
47+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
48+
49+
- name: update branch name
50+
run: |
51+
VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
52+
sed "s|PACKAGE_VERSION|$VERSION|" configure.ac.in > configure.ac
53+
env:
54+
GITHUB_REF_NAME: ${{ github.ref_name }}
55+
56+
- name: Build .deb package
57+
run: |
58+
# baue mit dpkg-buildpackage (ohne signieren)
59+
dpkg-buildpackage -us -uc -d
60+
61+
- name: Collect .deb artifact
62+
run: |
63+
mkdir -p artifacts/${{ matrix.os }}/${{ matrix.version }}
64+
mv ../module-pid-control*.deb artifacts/${{ matrix.os }}/${{ matrix.version }}
65+
66+
- name: Set sanitized image name
67+
id: sanitize
68+
run: |
69+
version=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
70+
echo "sanitized_image=$(echo "$version-$IMAGE" | tr '/:' '--')" >> $GITHUB_OUTPUT
71+
env:
72+
IMAGE: ${{ matrix.image }}
73+
74+
- name: Upload .deb package
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: module-pid-control-${{ steps.sanitize.outputs.sanitized_image }}.deb
78+
path: artifacts/${{ matrix.os }}/${{ matrix.version }}/*.deb
79+
80+
- name: Upload to Cloudsmith (${{ matrix.os }}/${{ matrix.version }})
81+
env:
82+
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
83+
shell: bash
84+
run: |
85+
VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
86+
FILENAME="artifacts/${{ matrix.os }}/${{ matrix.version }}/module-pid-control_${VERSION}_amd64.deb"
87+
88+
python3 -m venv cloudsmith
89+
cd cloudsmith
90+
source bin/activate
91+
92+
python3 -m pip install --upgrade pip
93+
pip3 install cloudsmith-cli
94+
95+
cloudsmith push deb robertburger/robotkernel/${{ matrix.os }}/${{ matrix.version }} ../${FILENAME} \
96+
--republish \
97+
--api-key "$CLOUDSMITH_API_KEY"

0 commit comments

Comments
 (0)