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+ # 4. Generate the initial debian/ directory
35+ # The -y flag accepts defaults, useful for automation
36+ - name : Run debmake to create packaging files
37+ run : debmake -ccc -y
38+
39+ # This is the new, more robust step to create the changelog
40+ - name : Create changelog with dch
41+ run : |
42+ # Get the latest git tag (e.g., v0.35.3) and remove the 'v'
43+ UPSTREAM_VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
44+ # Create a new changelog for the package with the version and a message
45+ dch --create --package arduino-cli --newversion "${UPSTREAM_VERSION}-1" "Initial release."
46+
47+ # 5. Build the .deb package
48+ # The flags -us -uc mean "unsigned source" and "unsigned changes",
49+ # which is necessary because we don't have a GPG key in the runner.
50+ - name : Build the package
51+ run : debuild -us -uc
52+
53+ # 6. Upload the generated .deb file as a build artifact
54+ # The .deb file is created in the parent directory, hence the ../
55+ - name : Upload .deb package
56+ uses : actions/upload-artifact@v4
57+ with :
58+ name : arduino-cli-deb-package
59+ path : ../*.deb
0 commit comments