Skip to content

Commit e6ae52f

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

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/build-deb.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# .github/workflows/build-deb.yml
2+
3+
name: Build Debian Package
4+
5+
on:
6+
push:
7+
branches: [ "main" ]
8+
pull_request:
9+
branches: [ "main" ]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
# 1. Checkout code with full history for versioning
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
# 2. Set up the Go environment
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: '1.22'
27+
28+
# 3. Install all necessary packaging tools
29+
- name: Install dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y debmake devscripts dh-golang
33+
34+
# 4. Run debmake to create the debian/ directory and its files
35+
- name: Run debmake to create packaging files
36+
run: debmake -y
37+
38+
# 5. (NEW) Verify that the debian/ directory was created
39+
- name: Verify debian/ directory existence
40+
run: |
41+
if [ ! -d "debian" ]; then
42+
echo "Error: debian/ directory was not created by debmake."
43+
exit 1
44+
fi
45+
echo "Success: debian/ directory created."
46+
ls -l
47+
48+
# 6. Create the watch file for checking new upstream versions
49+
- name: Create debian/watch file
50+
run: |
51+
echo 'version=4' > debian/watch
52+
echo 'opts="filenamemangle=s/.+\/v?(\d+\.\d+\.\d+)\.tar\.gz/arduino-cli-$1.tar.gz/" \' >> debian/watch
53+
echo ' https://github.com/arduino/arduino-cli/tags .*/v?(\d+\.\d+\.\d+)\.tar\.gz' >> debian/watch
54+
55+
# 7. Create a proper changelog with the correct version
56+
- name: Create changelog with dch
57+
run: |
58+
UPSTREAM_VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
59+
dch --create --package arduino-cli --newversion "${UPSTREAM_VERSION}-1" "Initial release."
60+
61+
# 8. Manually create the correct rules file for a Go package
62+
- name: Create Go-specific debian/rules
63+
run: |
64+
echo '#!/usr/bin/make -f' > debian/rules
65+
echo 'export DH_GOLANG_INSTALL_ROOT_PACKAGE=$(shell go list -m)' >> debian/rules
66+
echo '%' >> debian/rules
67+
echo -e '\tdh $@ --with golang' >> debian/rules
68+
69+
# 9. Verify that all required files exist before building
70+
- name: Verify Debian Files
71+
run: ls -l debian/
72+
73+
# 10. Build the package
74+
- name: Build the package
75+
run: debuild -us -uc
76+
77+
# 11. Upload the final .deb file
78+
- name: Upload .deb package
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: arduino-cli-deb-package
82+
path: ../*.deb

0 commit comments

Comments
 (0)