Skip to content

Commit 9e1b7a6

Browse files
committed
fix: indent of github action
1 parent 7162b10 commit 9e1b7a6

File tree

1 file changed

+183
-183
lines changed

1 file changed

+183
-183
lines changed

.github/workflows/build-deb.yaml

Lines changed: 183 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -1,192 +1,192 @@
11
name: Build and Publish Debian Package
22

33
on:
4-
push:
4+
push:
55

66
jobs:
7-
create_release:
8-
if: startsWith(github.ref, 'refs/tags/')
9-
runs-on: ubuntu-latest
10-
outputs:
11-
upload_url: ${{ steps.create_release.outputs.upload_url }}
12-
steps:
13-
- uses: actions/checkout@v3
14-
15-
- id: create_release
16-
uses: actions/create-release@v1
17-
env:
18-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
with:
20-
tag_name: ${{ github.ref_name }}
21-
release_name: Release ${{ github.ref_name }}
22-
body: Automated release for tag ${{ github.ref_name }}
23-
draft: false
24-
prerelease: false
25-
26-
build-deb:
27-
runs-on: ubuntu-latest
28-
env:
29-
DEB_BUILD_OPTIONS: "compress=gzip nocheck"
30-
PKGNAME: "module-pid-control"
31-
strategy:
32-
matrix:
33-
distro: [debian-12, debian-11, ubuntu-24.04, ubuntu-22.04]
34-
include:
35-
- distro: debian-12
36-
image: debian:12
37-
os: debian
38-
version: bookworm
39-
- distro: debian-11
40-
image: debian:11
41-
os: debian
42-
version: bullseye
43-
- distro: ubuntu-24.04
44-
image: ubuntu:24.04
45-
os: ubuntu
46-
version: noble
47-
- distro: ubuntu-22.04
48-
image: ubuntu:22.04
49-
os: ubuntu
50-
version: jammy
51-
container:
52-
image: ${{ matrix.image }}
53-
54-
steps:
55-
- name: Install build dependencies
56-
shell: bash
57-
run: |
58-
apt-get update
59-
apt-get install -y build-essential devscripts debhelper autoconf-archive autotools-dev pkg-config sed git tar gzip curl jq libyaml-cpp-dev rsync
60-
61-
curl -fsSL https://deb.burger-system.de/setup.sh | bash > /dev/null
62-
apt-get update
63-
apt-get install -y robotkernel-service-helper robotkernel-dev service-provider-process-data-inspection-dev
64-
65-
- name: Checkout source
66-
uses: actions/checkout@v4
67-
with:
68-
fetch-depth: 0
69-
70-
- name: Mark working directory as safe
71-
run: git config --global --add safe.directory $GITHUB_WORKSPACE
72-
73-
- name: update branch name and version
74-
run: |
75-
VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
76-
sed "s|PACKAGE_VERSION|$VERSION|" configure.ac.in > configure.ac
77-
78-
- name: Build .deb package
79-
shell: bash
80-
run: |
81-
# baue mit dpkg-buildpackage (ohne signieren)
82-
export DEBEMAIL="[email protected]"
83-
export DEBFULLNAME="Robert Burger"
84-
CODENAME=$(lsb_release -sc)
85-
VERSION=$(dpkg-parsechangelog --show-field Version)
86-
PRE_VERSION="pre${GITHUB_RUN_NUMBER}"
87-
88-
# Check if version already contains codename suffix
89-
if [[ "$VERSION" == *"~${CODENAME}"* || "$VERSION" == *"+${CODENAME}"* ]]; then
90-
echo "Version already contains codename suffix, skipping dch."
91-
else
92-
if [[ ! $GITHUB_REF =~ ^refs/tags/ ]]; then
93-
# Not a tag, so add ~pre<x>
94-
FULL_VERSION="${VERSION}~${PRE_VERSION}-1~${CODENAME}-pre"
95-
dch -b --newversion "${FULL_VERSION}" --distribution "${CODENAME}-pre" "Pre-release for ${CODENAME}-pre"
7+
create_release:
8+
if: startsWith(github.ref, 'refs/tags/')
9+
runs-on: ubuntu-latest
10+
outputs:
11+
upload_url: ${{ steps.create_release.outputs.upload_url }}
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- id: create_release
16+
uses: actions/create-release@v1
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
tag_name: ${{ github.ref_name }}
21+
release_name: Release ${{ github.ref_name }}
22+
body: Automated release for tag ${{ github.ref_name }}
23+
draft: false
24+
prerelease: false
25+
26+
build-deb:
27+
runs-on: ubuntu-latest
28+
env:
29+
DEB_BUILD_OPTIONS: "compress=gzip nocheck"
30+
PKGNAME: "module-pid-control"
31+
strategy:
32+
matrix:
33+
distro: [debian-12, debian-11, ubuntu-24.04, ubuntu-22.04]
34+
include:
35+
- distro: debian-12
36+
image: debian:12
37+
os: debian
38+
version: bookworm
39+
- distro: debian-11
40+
image: debian:11
41+
os: debian
42+
version: bullseye
43+
- distro: ubuntu-24.04
44+
image: ubuntu:24.04
45+
os: ubuntu
46+
version: noble
47+
- distro: ubuntu-22.04
48+
image: ubuntu:22.04
49+
os: ubuntu
50+
version: jammy
51+
container:
52+
image: ${{ matrix.image }}
53+
54+
steps:
55+
- name: Install build dependencies
56+
shell: bash
57+
run: |
58+
apt-get update
59+
apt-get install -y build-essential devscripts debhelper autoconf-archive autotools-dev pkg-config sed git tar gzip curl jq libyaml-cpp-dev rsync
60+
61+
curl -fsSL https://deb.burger-system.de/setup.sh | bash > /dev/null
62+
apt-get update
63+
apt-get install -y robotkernel-service-helper robotkernel-dev service-provider-process-data-inspection-dev
64+
65+
- name: Checkout source
66+
uses: actions/checkout@v4
67+
with:
68+
fetch-depth: 0
69+
70+
- name: Mark working directory as safe
71+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
72+
73+
- name: update branch name and version
74+
run: |
75+
VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
76+
sed "s|PACKAGE_VERSION|$VERSION|" configure.ac.in > configure.ac
77+
78+
- name: Build .deb package
79+
shell: bash
80+
run: |
81+
# baue mit dpkg-buildpackage (ohne signieren)
82+
export DEBEMAIL="[email protected]"
83+
export DEBFULLNAME="Robert Burger"
84+
CODENAME=$(lsb_release -sc)
85+
VERSION=$(dpkg-parsechangelog --show-field Version)
86+
PRE_VERSION="pre${GITHUB_RUN_NUMBER}"
87+
88+
# Check if version already contains codename suffix
89+
if [[ "$VERSION" == *"~${CODENAME}"* || "$VERSION" == *"+${CODENAME}"* ]]; then
90+
echo "Version already contains codename suffix, skipping dch."
9691
else
97-
FULL_VERSION="${VERSION}-1~${CODENAME}"
98-
dch --newversion "${FULL_VERSION}" --distribution "${CODENAME}" "Pre-release for ${CODENAME}"
92+
if [[ ! $GITHUB_REF =~ ^refs/tags/ ]]; then
93+
# Not a tag, so add ~pre<x>
94+
FULL_VERSION="${VERSION}~${PRE_VERSION}-1~${CODENAME}-pre"
95+
dch -b --newversion "${FULL_VERSION}" --distribution "${CODENAME}-pre" "Pre-release for ${CODENAME}-pre"
96+
else
97+
FULL_VERSION="${VERSION}-1~${CODENAME}"
98+
dch --newversion "${FULL_VERSION}" --distribution "${CODENAME}" "Pre-release for ${CODENAME}"
99+
fi
99100
fi
100-
fi
101-
102-
dpkg-buildpackage -us -uc -sa
103-
104-
- name: Debug artifact files
105-
run: |
106-
ls -l ../
107-
108-
- name: Set sanitized image name
109-
id: sanitize
110-
run: |
111-
version=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
112-
echo "sanitized_image=$(echo "${version}" | tr '/:' '--')" >> $GITHUB_OUTPUT
101+
102+
dpkg-buildpackage -us -uc -sa
103+
104+
- name: Debug artifact files
105+
run: |
106+
ls -l ../
113107
114-
- name: Upload to APT repository
115-
env:
116-
DEPLOY_TOKEN: ${{ secrets.BS_UPLOAD_KEY }}
117-
shell: bash
118-
run: |
119-
DISTRO="${{ matrix.distro }}"
120-
SANITIZED_IMAGE="${{ steps.sanitize.outputs.sanitized_image }}"
121-
122-
if [[ "$DISTRO" == "ubuntu-24.04" || "$DISTRO" == "ubuntu-22.04" ]]; then
123-
OLD_EXT=".ddeb"
124-
NEW_EXT=".deb"
125-
126-
OLD_FILE="${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64${OLD_EXT}"
127-
NEW_FILE="${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64${NEW_EXT}"
128-
CHANGES_FILE="${PKGNAME}_${SANITIZED_IMAGE}_amd64.changes"
129-
130-
mv "../$OLD_FILE" "../$NEW_FILE"
131-
sed -i "s/${OLD_FILE}/${NEW_FILE}/g" "../$CHANGES_FILE"
132-
fi
133-
134-
DBG_FILE="../${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64.deb"
135-
DEB_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.deb"
136-
CHANGES_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.changes"
137-
BUILDINFO_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.buildinfo"
138-
DSC_FILE="../${PKGNAME}_${SANITIZED_IMAGE}.dsc"
139-
TAR_FILE="../${PKGNAME}_${SANITIZED_IMAGE}.tar.gz"
140-
141-
for f in "$DEB_FILE" "$DBG_FILE" "$CHANGES_FILE" "$BUILDINFO_FILE" "$DSC_FILE" "$TAR_FILE"; do
142-
[[ -f "$f" ]] || { echo "Missing file: $f"; exit 1; }
143-
done
144-
145-
curl -X POST https://deb.burger-system.de/upload \
146-
-H "Authorization: Bearer $DEPLOY_TOKEN" \
147-
-F "deb=@$DEB_FILE" \
148-
-F "dbgsym=@$DBG_FILE" \
149-
-F "changes=@$CHANGES_FILE" \
150-
-F "buildinfo=@$BUILDINFO_FILE" \
151-
-F "dsc=@$DSC_FILE" \
152-
-F "source=@$TAR_FILE"
153-
154-
- name: Collect .deb artifact
155-
run: |
156-
mkdir -p artifacts/
157-
rsync -av --exclude=${PKGNAME} ../ artifacts/
158-
159-
- name: Upload .deb package artifact
160-
uses: actions/upload-artifact@v4
161-
with:
162-
name: ${{ env.PKGNAME }}-artifacts-${{ steps.sanitize.outputs.sanitized_image }}
163-
path: artifacts/
164-
165-
# Fetch the release upload URL dynamically on tag builds
166-
- name: Upload all artifacts to Release
167-
if: startsWith(github.ref, 'refs/tags/')
168-
env:
169-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170-
GITHUB_REF_NAME: ${{ github.ref_name }}
171-
run: |
172-
release_json=$(curl -sSL \
173-
-H "Authorization: token $GITHUB_TOKEN" \
174-
-H "Accept: application/vnd.github.v3+json" \
175-
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${GITHUB_REF_NAME}")
176-
177-
upload_url=$(echo "$release_json" | jq -r '.upload_url' | sed -e "s/{?name,label}//")
178-
echo "Release upload URL: $upload_url"
179-
180-
if [ -d "./artifacts" ]; then
181-
for file in ./artifacts/*; do
182-
filename=$(basename "$file")
183-
echo "Uploading $file as $filename"
184-
curl --fail -X POST \
185-
-H "Authorization: token $GITHUB_TOKEN" \
186-
-H "Content-Type: application/octet-stream" \
187-
--data-binary @"$file" \
188-
"$upload_url?name=$filename"
108+
- name: Set sanitized image name
109+
id: sanitize
110+
run: |
111+
version=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
112+
echo "sanitized_image=$(echo "${version}" | tr '/:' '--')" >> $GITHUB_OUTPUT
113+
114+
- name: Upload to APT repository
115+
env:
116+
DEPLOY_TOKEN: ${{ secrets.BS_UPLOAD_KEY }}
117+
shell: bash
118+
run: |
119+
DISTRO="${{ matrix.distro }}"
120+
SANITIZED_IMAGE="${{ steps.sanitize.outputs.sanitized_image }}"
121+
122+
if [[ "$DISTRO" == "ubuntu-24.04" || "$DISTRO" == "ubuntu-22.04" ]]; then
123+
OLD_EXT=".ddeb"
124+
NEW_EXT=".deb"
125+
126+
OLD_FILE="${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64${OLD_EXT}"
127+
NEW_FILE="${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64${NEW_EXT}"
128+
CHANGES_FILE="${PKGNAME}_${SANITIZED_IMAGE}_amd64.changes"
129+
130+
mv "../$OLD_FILE" "../$NEW_FILE"
131+
sed -i "s/${OLD_FILE}/${NEW_FILE}/g" "../$CHANGES_FILE"
132+
fi
133+
134+
DBG_FILE="../${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64.deb"
135+
DEB_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.deb"
136+
CHANGES_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.changes"
137+
BUILDINFO_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.buildinfo"
138+
DSC_FILE="../${PKGNAME}_${SANITIZED_IMAGE}.dsc"
139+
TAR_FILE="../${PKGNAME}_${SANITIZED_IMAGE}.tar.gz"
140+
141+
for f in "$DEB_FILE" "$DBG_FILE" "$CHANGES_FILE" "$BUILDINFO_FILE" "$DSC_FILE" "$TAR_FILE"; do
142+
[[ -f "$f" ]] || { echo "Missing file: $f"; exit 1; }
189143
done
190-
else
191-
echo "Artifacts directory not found, skipping upload."
192-
fi
144+
145+
curl -X POST https://deb.burger-system.de/upload \
146+
-H "Authorization: Bearer $DEPLOY_TOKEN" \
147+
-F "deb=@$DEB_FILE" \
148+
-F "dbgsym=@$DBG_FILE" \
149+
-F "changes=@$CHANGES_FILE" \
150+
-F "buildinfo=@$BUILDINFO_FILE" \
151+
-F "dsc=@$DSC_FILE" \
152+
-F "source=@$TAR_FILE"
153+
154+
- name: Collect .deb artifact
155+
run: |
156+
mkdir -p artifacts/
157+
rsync -av --exclude=${PKGNAME} ../ artifacts/
158+
159+
- name: Upload .deb package artifact
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: ${{ env.PKGNAME }}-artifacts-${{ steps.sanitize.outputs.sanitized_image }}
163+
path: artifacts/
164+
165+
# Fetch the release upload URL dynamically on tag builds
166+
- name: Upload all artifacts to Release
167+
if: startsWith(github.ref, 'refs/tags/')
168+
env:
169+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170+
GITHUB_REF_NAME: ${{ github.ref_name }}
171+
run: |
172+
release_json=$(curl -sSL \
173+
-H "Authorization: token $GITHUB_TOKEN" \
174+
-H "Accept: application/vnd.github.v3+json" \
175+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${GITHUB_REF_NAME}")
176+
177+
upload_url=$(echo "$release_json" | jq -r '.upload_url' | sed -e "s/{?name,label}//")
178+
echo "Release upload URL: $upload_url"
179+
180+
if [ -d "./artifacts" ]; then
181+
for file in ./artifacts/*; do
182+
filename=$(basename "$file")
183+
echo "Uploading $file as $filename"
184+
curl --fail -X POST \
185+
-H "Authorization: token $GITHUB_TOKEN" \
186+
-H "Content-Type: application/octet-stream" \
187+
--data-binary @"$file" \
188+
"$upload_url?name=$filename"
189+
done
190+
else
191+
echo "Artifacts directory not found, skipping upload."
192+
fi

0 commit comments

Comments
 (0)