Skip to content

Commit a01b2e8

Browse files
author
Your Name
committed
packaging
1 parent 27531bd commit a01b2e8

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/build-deb.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# .github/workflows/build-deb.yml
2+
3+
name: Build Debian Package
4+
5+
# This action runs on every push to the main branch
6+
on:
7+
push:
8+
branches: [ "main", "deb_package_pipeline" ]
9+
pull_request:
10+
branches: [ "main", "deb_package_pipeline" ]
11+
12+
jobs:
13+
build:
14+
# Use the latest version of Ubuntu as our build environment
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
# 1. Check out your repository's code
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
# 2. Set up the Go environment needed by arduino-cli
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: '1.25' # Check go.mod for the correct version
27+
28+
# 3. Install Debian packaging tools
29+
- name: Install dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y debmake devscripts
33+
34+
- name: Run debmake to create packaging files
35+
run: debmake -t -y -ccc
36+
37+
- name: Create debian/watch file
38+
run: |
39+
echo 'version=4' > debian/watch
40+
echo 'opts="filenamemangle=s/.+\/v?(\d+\.\d+\.\d+)\.tar\.gz/arduino-cli-$1.tar.gz/" \' >> debian/watch
41+
42+
- name: Create changelog with dch
43+
run: |
44+
UPSTREAM_VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
45+
dch --create --package arduino-cli --newversion "${UPSTREAM_VERSION}-1" "Initial release."
46+
47+
- name: Create Go-specific debian/rules
48+
run: |
49+
echo '#!/usr/bin/make -f' > debian/rules
50+
echo 'export DH_GOLANG_INSTALL_ROOT_PACKAGE=$(shell go list -m)' >> debian/rules
51+
echo '%' >> debian/rules
52+
echo -e '\tdh $@ --with golang' >> debian/rules
53+
54+
# 5. Build the .deb package
55+
# The flags -us -uc mean "unsigned source" and "unsigned changes",
56+
# which is necessary because we don't have a GPG key in the runner.
57+
- name: Build the package
58+
run: debuild -us -uc
59+
60+
# 6. Upload the generated .deb file as a build artifact
61+
# The .deb file is created in the parent directory, hence the ../
62+
- name: Upload .deb package
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: arduino-cli-deb-package
66+
path: ../*.deb

0 commit comments

Comments
 (0)