Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Debian package quality (and build GitHub Release from GitHub Actions) #31

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/deb-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Debian Package Build

on:
pull_request:
branches:
- master
push:
branches:
- master

env:
DEB_BUILD_DOCKER_IMAGE: "pitop/pi-top-os-deb-build"
DEB_BUILD_DOCKER_TAG: "latest"
CHANGELOG_AUTHOR_NAME: "pi-top"
CHANGELOG_AUTHOR_EMAIL: "[email protected]"

jobs:
build-debian-package:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/[email protected]

- id: version
uses: docker://lpenz/ghaction-version-gen:0.3

- name: Add changelog entry for latest snapshot version
uses: pi-top/git-debian-changelog-bump-action@master
with:
release: false
author_name: ${{ env.CHANGELOG_AUTHOR_NAME }}
author_email: ${{ env.CHANGELOG_AUTHOR_EMAIL }}
snapshot_number: ${{ steps.version.outputs.distance }}
since: ${{ steps.version.outputs.tag_latest }}

# We only want ARM builds. This step is here to provide the option of
# using a strategy matrix if additional builds (e.g. `arm64`) are desired
- name: Determine architecture to use from package info
# If architecture is 'all', then it can be compiled on host architecture
# All other pi-topOS cases require 'armhf'
run: |
target_architecture=amd64
if grep '^Architecture:' debian/control | grep -q -v 'all'; then
target_architecture=armhf
fi
echo "TARGET_ARCHITECTURE=${target_architecture}" >> $GITHUB_ENV

- name: Build Debian package
uses: pi-top/debian-package-build-action@master
with:
target_architecture: ${{ env.TARGET_ARCHITECTURE }}
docker_image: ${{ env.DEB_BUILD_DOCKER_IMAGE }}:${{ env.DEB_BUILD_DOCKER_TAG }}
build_directory: ./artifacts

- name: Generate artifact name
run: |
echo "ARTIFACT_PREFIX=$(basename -s .dsc "$(find . -name "*.dsc")")" >> $GITHUB_ENV

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_PREFIX }}.deb
path: ./artifacts/*.deb

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_PREFIX }}.deb-src
path: ./artifacts/*.tar.xz

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_PREFIX }}.metadata
path: |
./artifacts/**
!./artifacts/*.deb
!./artifacts/*.tar.xz
63 changes: 63 additions & 0 deletions .github/workflows/deb-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Create GitHub Release

on:
workflow_dispatch:
branches:
- master

env:
DEB_BUILD_DOCKER_IMAGE: "pitop/pi-top-os-deb-build"
DEB_BUILD_DOCKER_TAG: "latest"

jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/[email protected]

- id: version
uses: docker://lpenz/ghaction-version-gen:0.3

- name: Determine current and last tagged versions
run: |
sudo apt install -y dpkg-dev
echo "CURRENT_VERSION=$(dpkg-parsechangelog -Sversion)" >> $GITHUB_ENV

- name: Confirm version is higher than last tagged version
if: steps.version.outputs.tag_latest != ""
run: dpkg --compare-versions ${{ env.CURRENT_VERSION }} gt ${{ steps.version.outputs.tag_latest }}

- name: Determine architecture to use from package info
# If architecture is 'all', then it can be compiled on host architecture
# All other pi-topOS cases require 'armhf'
run: |
target_architecture=amd64
if grep '^Architecture:' debian/control | grep -q -v 'all'; then
target_architecture=armhf
fi
echo "TARGET_ARCHITECTURE=${target_architecture}" >> $GITHUB_ENV

- name: Build Debian package
uses: pi-top/debian-package-build-action@master
with:
target_architecture: ${{ env.TARGET_ARCHITECTURE }}
docker_image: ${{ env.DEB_BUILD_DOCKER_IMAGE }}:${{ env.DEB_BUILD_DOCKER_TAG }}
build_directory: ./artifacts

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: "dsc"
path: "./artifacts"

- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ env.CURRENT_VERSION }}"
name: "v${{ env.CURRENT_VERSION }}"
draft: false
prerelease: false
files: ./artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/deb-update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Update Debian Package Changelog

on:
workflow_dispatch:
branches:
- master

env:
CHANGELOG_AUTHOR_NAME: "pi-top"
CHANGELOG_AUTHOR_EMAIL: "[email protected]"
COMMIT_MESSAGE_PREFIX: "New changelog entry: v"

jobs:
commit-updated-changelog:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/[email protected]

- id: version
uses: docker://lpenz/ghaction-version-gen:0.3

- name: Add changelog entry for release version
uses: pi-top/git-debian-changelog-bump-action@master
with:
release: true
author_name: ${{ env.CHANGELOG_AUTHOR_NAME }}
author_email: ${{ env.CHANGELOG_AUTHOR_EMAIL }}
snapshot_number: ${{ steps.version.outputs.distance }}
since: ${{ steps.version.outputs.tag_latest }}
# Don't include previous changelog version bump commits in changelog
ignore_regex: |
${{ env. COMMIT_MESSAGE_PREFIX }}

- name: Determine current version
run: |
sudo apt install -y dpkg-dev
echo "CURRENT_VERSION=$(dpkg-parsechangelog -Sversion)" >> $GITHUB_ENV

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "${{ env.COMMIT_MESSAGE_PREFIX }}${{ env.CURRENT_VERSION }}"
branch: master
3 changes: 3 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@Library("devops-jenkins-shared-library@master") _

buildOSPackage()
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# raspi2png

Utility to take a snapshot of the raspberry pi screen and save it as a PNG file
Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG file

Usage: raspi2png [--pngname name] [--width <width>] [--height <height>] [--compression <level>] [--delay <delay>] [--display <number>] [--stdout] [--help]

Expand Down
29 changes: 28 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
raspi2png (0.1-1) unstable; urgency=low
raspi2png (1:0.1-1+nmu2) unstable; urgency=medium

* Update package handling
* Add tar-ignore to debian/source/options
* Drop source/options

-- pi-top <[email protected]> Wed, 05 May 2021 13:22:32 +0000

raspi2png (1:0.1-1+nmu1) unstable; urgency=medium

* Non-maintainer upload.
* Move back to non-native package
* Bump epoch version to allow update path
* Add hardening

-- pi-top <[email protected]> Tue, 04 May 2021 15:35:31 +0100

raspi2png (0.1+nmu1) unstable; urgency=medium

* Non-maintainer upload.
* Native package
* compat level 12
* Update build dependency: libpng12-dev --> libpng-dev
* Hard-code possible architectures to ARM only (armhf, arm64)

-- pi-top <[email protected]> Tue, 02 Mar 2021 11:48:37 +0000

raspi2png (0.1) unstable; urgency=medium

* debianizing https://github.com/AndrewFromMelbourne/raspi2png

Expand Down
1 change: 0 additions & 1 deletion debian/compat

This file was deleted.

13 changes: 9 additions & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ Source: raspi2png
Section: utils
Priority: optional
Maintainer: Przemyslaw Wegrzyn <[email protected]>
Build-Depends: debhelper (>= 9), libpng12-dev, libraspberrypi-dev
Standards-Version: 3.9.5
Build-Depends:
debhelper-compat (= 12),
libpng-dev,
libraspberrypi-dev,
Standards-Version: 4.5.1
Homepage: https://github.com/AndrewFromMelbourne/raspi2png/

Package: raspi2png
Architecture: any
Architecture: armhf arm64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG file.
Description: Raspberry Pi Screenshot Utility
Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG
file.
1 change: 1 addition & 0 deletions debian/raspi2png.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
raspi2png: no-manual-page usr/bin/raspi2png
9 changes: 1 addition & 8 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# main packaging script based on dh7 syntax
%:
dh $@

Binary file removed raspi2png
Binary file not shown.