1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
name: Build Debian Package
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v5
- name: Install build dependencies
run: |
sudo apt-get update
# Install essential Debian packaging tools
sudo apt-get install -y \
build-essential devscripts debhelper fakeroot lintian
sudo apt-get build-dep -y .
- name: Generate dpkg-changelog entry
run: |
export DEBFULLNAME="${{ github.actor }}"
export DEBEMAIL="${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
DEB_VERSION=0.$(date +'%Y%m%d').0~git~$(git rev-parse --short HEAD)
dch -b -v $DEB_VERSION --package git-keeper "Automated build on Github Actions for ${{ github.ref }}"
- name: Build Debian package
run: |
dpkg-buildpackage -us -uc -b
- name: Run litian
run: lintian -IE
- name: Show results
run: |
ls -lh ..
echo "Generated DEB files:"
ls -lh ../*.deb
dpkg -I ../*.deb
dpkg -c ../*.deb
mv ../*.deb ./
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: debian-packages
path: ./*.deb
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
# manual trigger or a tag push
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: debian-packages
- name: Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.event_name == 'workflow_dispatch' && 'rolling' || github.ref_name }}
name: ${{ github.event_name == 'workflow_dispatch' && 'rolling' || github.ref_name }}
prerelease: ${{ github.event_name == 'workflow_dispatch' && 'true' || 'false' }}
allowUpdates: true
artifacts: '*.deb'
token: ${{ secrets.GITHUB_TOKEN }}
|