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 changelog with dch
38+ run : |
39+ UPSTREAM_VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
40+ dch --create --package arduino-cli --newversion "${UPSTREAM_VERSION}-1" "Initial release."
41+
42+ - name : Create Go-specific debian/rules
43+ run : |
44+ echo '#!/usr/bin/make -f' > debian/rules
45+ echo 'export DH_GOLANG_INSTALL_ROOT_PACKAGE=$(shell go list -m)' >> debian/rules
46+ echo '%' >> debian/rules
47+ echo -e '\tdh $@ --with golang' >> debian/rules
48+
49+ # 5. Build the .deb package
50+ # The flags -us -uc mean "unsigned source" and "unsigned changes",
51+ # which is necessary because we don't have a GPG key in the runner.
52+ - name : Build the package
53+ run : debuild -us -uc
54+
55+ # 6. Upload the generated .deb file as a build artifact
56+ # The .deb file is created in the parent directory, hence the ../
57+ - name : Upload .deb package
58+ uses : actions/upload-artifact@v4
59+ with :
60+ name : arduino-cli-deb-package
61+ path : ../*.deb
0 commit comments