Configure CI to build & publish new release
All checks were successful
Run tests / tests (push) Successful in 1m29s
All checks were successful
Run tests / tests (push) Successful in 1m29s
This commit is contained in:
parent
97f4875aee
commit
84948738bc
10 changed files with 191 additions and 0 deletions
85
.forgejo/workflows/release.yaml
Normal file
85
.forgejo/workflows/release.yaml
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
---
|
||||||
|
name: Build and publish Debian package
|
||||||
|
on: [create]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/brenard/debian-python-deb:latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Build Debian package
|
||||||
|
env:
|
||||||
|
MAINTAINER_NAME: ${{ vars.MAINTAINER_NAME }}
|
||||||
|
MAINTAINER_EMAIL: ${{ vars.MAINTAINER_EMAIL }}
|
||||||
|
DEBIAN_CODENAME: ${{ vars.DEBIAN_CODENAME }}
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.GPG_KEY }}"|base64 -d|gpg --import
|
||||||
|
./build.sh
|
||||||
|
- name: Upload Debian package files
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: |
|
||||||
|
dist
|
||||||
|
|
||||||
|
publish-forgejo:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/brenard/debian-python-deb:latest
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
steps:
|
||||||
|
- name: Download Debian package files
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
|
||||||
|
- name: Create the release
|
||||||
|
id: create-release
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir release
|
||||||
|
mv *.deb release/
|
||||||
|
mv check-pg-streaming-replication-*/check_pg_streaming_replication release/
|
||||||
|
{
|
||||||
|
echo 'release_note<<EOF'
|
||||||
|
cat release_notes.md
|
||||||
|
echo 'EOF'
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Publish release on Forgejo
|
||||||
|
uses: actions/forgejo-release@v2.2.0
|
||||||
|
with:
|
||||||
|
direction: upload
|
||||||
|
url: https://gitea.zionetrix.net
|
||||||
|
token: ${{ secrets.forgejo_token }}
|
||||||
|
release-dir: release
|
||||||
|
release-notes: ${{ steps.create-release.outputs.release_note }}
|
||||||
|
verbose: true
|
||||||
|
override: true
|
||||||
|
|
||||||
|
publish-aptly:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/brenard/aptly-publish:latest
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
steps:
|
||||||
|
- name: "Download Debian package files"
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
|
||||||
|
- name: "Publish Debian package on Aptly repository"
|
||||||
|
uses: https://gitea.zionetrix.net/bn8/aptly-publish@master
|
||||||
|
with:
|
||||||
|
api_url: ${{ vars.apt_api_url }}
|
||||||
|
api_username: ${{ vars.apt_api_username }}
|
||||||
|
api_password: ${{ secrets.apt_api_password }}
|
||||||
|
repo_name: ${{ vars.apt_repo_name }}
|
||||||
|
path: "./"
|
||||||
|
source_name: ${{ vars.apt_source_name }}
|
7
.yamllint.yml
Normal file
7
.yamllint.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
line-length:
|
||||||
|
max: 100
|
||||||
|
level: warning
|
59
build.sh
Executable file
59
build.sh
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
QUIET_ARG=""
|
||||||
|
[ "$1" == "--quiet" ] && QUIET_ARG="--quiet"
|
||||||
|
|
||||||
|
# Enter source directory
|
||||||
|
cd "$( dirname "$0" )" || exit
|
||||||
|
|
||||||
|
echo "Clean previous build..."
|
||||||
|
rm -fr dist
|
||||||
|
|
||||||
|
echo "Detect version using git describe..."
|
||||||
|
VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )"
|
||||||
|
|
||||||
|
echo "Create building environemt..."
|
||||||
|
BDIR=dist/check-pg-streaming-replication-$VERSION
|
||||||
|
mkdir -p "$BDIR"
|
||||||
|
[ -z "$QUIET_ARG" ] && RSYNC_ARG="-v" || RSYNC_ARG=""
|
||||||
|
rsync -a "$RSYNC_ARG" debian/ "$BDIR"/debian/
|
||||||
|
cp check_pg_streaming_replication "$BDIR"/
|
||||||
|
|
||||||
|
echo "Set VERSION=$VERSION in gitdch using sed..."
|
||||||
|
sed -i "s/^VERSION *=.*$/VERSION = '$VERSION'/" "$BDIR"/check_pg_streaming_replication
|
||||||
|
|
||||||
|
if [ -z "$DEBIAN_CODENAME" ]; then
|
||||||
|
echo "Retrieve debian codename using lsb_release..."
|
||||||
|
DEBIAN_CODENAME=$( lsb_release -c -s )
|
||||||
|
else
|
||||||
|
echo "Use debian codename from environment ($DEBIAN_CODENAME)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Generate debian changelog using gitdch..."
|
||||||
|
GITDCH_ARGS=('--verbose')
|
||||||
|
[ -n "$QUIET_ARG" ] && GITDCH_ARGS=('--warning')
|
||||||
|
if [ -n "$MAINTAINER_NAME" ]; then
|
||||||
|
echo "Use maintainer name from environment ($MAINTAINER_NAME)"
|
||||||
|
GITDCH_ARGS+=("--maintainer-name" "${MAINTAINER_NAME}")
|
||||||
|
fi
|
||||||
|
if [ -n "$MAINTAINER_EMAIL" ]; then
|
||||||
|
echo "Use maintainer email from environment ($MAINTAINER_EMAIL)"
|
||||||
|
GITDCH_ARGS+=("--maintainer-email" "$MAINTAINER_EMAIL")
|
||||||
|
fi
|
||||||
|
gitdch \
|
||||||
|
--package-name check-pg-streaming-replication \
|
||||||
|
--version "${VERSION}" \
|
||||||
|
--code-name "$DEBIAN_CODENAME" \
|
||||||
|
--output "$BDIR"/debian/changelog \
|
||||||
|
--release-notes dist/release_notes.md \
|
||||||
|
"${GITDCH_ARGS[@]}"
|
||||||
|
|
||||||
|
if [[ -n "$MAINTAINER_NAME" ]] && [[ -n "$MAINTAINER_EMAIL" ]]; then
|
||||||
|
echo "Set Maintainer field in debian control file ($MAINTAINER_NAME <$MAINTAINER_EMAIL>)..."
|
||||||
|
sed -i "s/^Maintainer: .*$/Maintainer: $MAINTAINER_NAME <$MAINTAINER_EMAIL>/" \
|
||||||
|
"$BDIR"/debian/control
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Build debian package..."
|
||||||
|
cd "$BDIR" || exit
|
||||||
|
dpkg-buildpackage
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
11
|
12
debian/control
vendored
Normal file
12
debian/control
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
Source: check-pg-streaming-replication
|
||||||
|
Section: admin
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Debian Zionetrix - check-pg-streaming-replication <debian+check-pg-streaming-replication@zionetrix.net>
|
||||||
|
Build-Depends: debhelper (>> 11.0.0)
|
||||||
|
Standards-Version: 3.9.6
|
||||||
|
|
||||||
|
Package: check-pg-streaming-replication
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends}, python3, python3-requests
|
||||||
|
Description: Monitoring plugin to check Postgres Streaming replication state
|
||||||
|
This Icinga/Nagios check plugin permit to check Postgres Streaming replication state.
|
20
debian/copyright
vendored
Normal file
20
debian/copyright
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
This package was written by Benjamin Renard <brenard@zionetrix.net>.
|
||||||
|
|
||||||
|
Copyright (C) 2024 Benjamin Renard <brenard@zionetrix.net>
|
||||||
|
|
||||||
|
check-pg-streaming-replication is licensed under the GNU general public license, version 3.
|
||||||
|
|
||||||
|
check-pg-streaming-replication is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 3, or (at your option) any later version.
|
||||||
|
|
||||||
|
check-pg-streaming-replication is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
check-pg-streaming-replication; see the file COPYING. If not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
On Debian systems, a copy of the GNU General Public License is available in
|
||||||
|
/usr/share/common-licenses/GPL-3 as part of the base-files package.
|
1
debian/dirs
vendored
Normal file
1
debian/dirs
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
usr/lib/nagios/plugins
|
1
debian/install
vendored
Normal file
1
debian/install
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
check_pg_streaming_replication usr/lib/nagios/plugins
|
4
debian/rules
vendored
Executable file
4
debian/rules
vendored
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/make -f
|
||||||
|
#export DH_VERBOSE=1
|
||||||
|
%:
|
||||||
|
dh $@
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1.0
|
Loading…
Reference in a new issue