Skip to content

Really Fix GitHub Actions workflow for building and uploading Debian … #5

Really Fix GitHub Actions workflow for building and uploading Debian …

Really Fix GitHub Actions workflow for building and uploading Debian … #5

Workflow file for this run

name: Build Debian Package
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-deb:
name: Build and Package
runs-on: ubuntu-latest
steps:
# Checkout repository
- name: Checkout code
uses: actions/checkout@v3
# Set up dependencies
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y build-essential debhelper devscripts lintian
# Generate version number
- name: Increment version number
id: version
run: |
# Extract the current version from changelog
if [ -f "debian/changelog" ]; then
CURRENT_VERSION=$(dpkg-parsechangelog --show-field Version | cut -d'-' -f1)
else
CURRENT_VERSION="1.0.0"
fi
# Increment the version (minor bump for now)
NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F. '{printf "%d.%d.%d", $1, $2 + 1, 0}')
# Update the changelog with the new version
export DEBFULLNAME="GitHub Actions"
export DEBEMAIL="[email protected]"
dch -v "$NEW_VERSION-1" "Automated build of version $NEW_VERSION"
# Output the new version number for later steps
echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
# Build the package
- name: Build Debian package
run: |
dpkg-buildpackage -us -uc -b -d
mkdir -p build
mv ../*.deb build/
# Upload artifact
- name: Upload Debian package
uses: actions/upload-artifact@v3
with:
name: wlanpi-usb-ethernet_${{ env.new_version }}
path: build/*.deb