Skip to content

Commit

Permalink
Merge pull request #3 from noris-network/github_actions
Browse files Browse the repository at this point in the history
Added Github Actions Workflow to build debian package and export .deb file in a new release
  • Loading branch information
athamana authored Feb 24, 2025
2 parents 1fce260 + c40315c commit ef298e9
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Release .deb Package

on:
push:
tags:
- 'v*.*.*' # Trigger only on tags matching this pattern

jobs:
build-deb:
runs-on: ubuntu-24.04
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Compute the version by using github.ref_name (e.g., "v0.2.1")
- name: Compute Version
id: version
env:
REF_NAME: ${{ github.ref_name }}
run: |
# Remove the leading "v" from the ref name (e.g., v0.2.1 becomes 0.2.1)
VERSION=${REF_NAME#v}
echo "Computed version: $VERSION"
echo "build_version=$VERSION" >> $GITHUB_OUTPUT
- name: Build .deb package
env:
BUILD_VERSION: ${{ steps.version.outputs.build_version }}
run: |
echo "Using BUILD_VERSION: $BUILD_VERSION"
chmod +x build_deb.sh
./build_deb.sh
- name: Upload .deb to GitHub Releases
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: pysieved_${{ steps.version.outputs.build_version }}.deb
name: Pysieved ${{ github.ref_name }}
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ All notable changes to this project will be documented in this file.
* Fixed imports in `./pysieved/main.py`
* Fixed imports in `./pysieved/plugins/htpasswd.py`
* Updated `./.gitignore`, to ignore locally built debian packages

#### 2025-02-19

* Added `./.github/workflows/build-deb.yml` file to build and release debian package with Github Actions
* Updated `./debian/build_deb.sh` script to automatically update the debian changelog before building the debian package
7 changes: 5 additions & 2 deletions build_deb.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash

export BUILD_VERSION=0.2.0
export BUILD_VERSION=${BUILD_VERSION:-0.2.0}

docker build -t pysieved-deb-builder .
docker run --name pysieved-builder pysieved-deb-builder dpkg-buildpackage -b -us -uc -rfakeroot -tc
docker run --name pysieved-builder pysieved-deb-builder bash -c "
dch --newversion '${BUILD_VERSION}' --distribution unstable --urgency medium 'Autogenerated version' &&
dpkg-buildpackage -b -us -uc -rfakeroot -tc
"
docker cp pysieved-builder:/root/pysieved_${BUILD_VERSION}_amd64.deb pysieved_${BUILD_VERSION}.deb
docker rm -f pysieved-builder

0 comments on commit ef298e9

Please # to comment.