diff --git a/.github/workflows/build-deb.yml b/.github/workflows/build-deb.yml new file mode 100644 index 0000000..a35fd68 --- /dev/null +++ b/.github/workflows/build-deb.yml @@ -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 }} diff --git a/CHANGES.md b/CHANGES.md index 4ad3274..e1bff1f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 \ No newline at end of file diff --git a/build_deb.sh b/build_deb.sh index 2a6da0a..1cddaf2 100755 --- a/build_deb.sh +++ b/build_deb.sh @@ -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