Release 3.3.0
This commit is contained in:
commit
ff0be11dc6
13 changed files with 358 additions and 0 deletions
83
.forgejo/workflows/release.yaml
Normal file
83
.forgejo/workflows/release.yaml
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
---
|
||||||
|
name: Build and publish ${{ vars.apt_source_name }} 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/*.buildinfo
|
||||||
|
dist/*.changes
|
||||||
|
dist/*.deb
|
||||||
|
dist/*.dsc
|
||||||
|
dist/*.tar.gz
|
||||||
|
dist/release_notes.md
|
||||||
|
|
||||||
|
publish-forgejo:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/brenard/debian-python-deb:latest
|
||||||
|
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/
|
||||||
|
{
|
||||||
|
echo 'release_note<<EOF'
|
||||||
|
cat release_notes.md
|
||||||
|
echo 'EOF'
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Publish release on Forgejo
|
||||||
|
uses: actions/forgejo-release@v1
|
||||||
|
with:
|
||||||
|
direction: upload
|
||||||
|
url: https://gitea.zionetrix.net
|
||||||
|
token: ${{ secrets.forgejo_token }}
|
||||||
|
release-dir: release
|
||||||
|
release-notes: ${{ steps.create-release.outputs.release_note }}
|
||||||
|
|
||||||
|
publish-aptly:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/brenard/aptly-publish:latest
|
||||||
|
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 }}
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*~
|
||||||
|
.*.swp
|
||||||
|
/dist
|
119
build.sh
Executable file
119
build.sh
Executable file
|
@ -0,0 +1,119 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DEBUG=0
|
||||||
|
INSTALL_DEPS=0
|
||||||
|
QUIET_ARG=""
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
[ -n "$@" ] && echo -e "$@\n" > /dev/stderr
|
||||||
|
echo "Usage: $0 [-x] [-I]"
|
||||||
|
echo " -I/--install-deps Install build dependencies"
|
||||||
|
echo " -q/--quiet Enable quiet mode"
|
||||||
|
echo " -x/--debug Enable debug mode"
|
||||||
|
[ -n "$@" ] && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
idx=1
|
||||||
|
while [ $idx -le $# ]
|
||||||
|
do
|
||||||
|
OPT=${!idx}
|
||||||
|
case $OPT in
|
||||||
|
-I|--install-deps)
|
||||||
|
INSTALL_DEPS=1
|
||||||
|
;;
|
||||||
|
-q|--quiet)
|
||||||
|
QUIET_ARG="--quiet"
|
||||||
|
;;
|
||||||
|
-x|--debug)
|
||||||
|
set -x
|
||||||
|
DEBUG=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage "Unkown parameter '$OPT'"
|
||||||
|
esac
|
||||||
|
let idx=idx+1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Enter source directory
|
||||||
|
cd $( dirname $0 )
|
||||||
|
|
||||||
|
# Install build dependencies
|
||||||
|
if [ $INSTALL_DEPS -eq 1 ]
|
||||||
|
then
|
||||||
|
echo "Install build dependencies..."
|
||||||
|
apt-get update
|
||||||
|
apt-get install --no-install-recommends --yes \
|
||||||
|
$(grep Build-Depends debian/control|sed 's/Build-Depends: //'|sed 's/([^)]\+)//'|tr -d ',')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Clean previous build..."
|
||||||
|
rm -fr dist
|
||||||
|
|
||||||
|
echo "Detect version using git describe..."
|
||||||
|
[ $DEBUG -eq 1 ] && git show
|
||||||
|
VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )-0"
|
||||||
|
|
||||||
|
echo "Create building environment..."
|
||||||
|
BDIR=dist/forgejo-runner-$VERSION
|
||||||
|
mkdir -p $BDIR
|
||||||
|
[ -z "$QUIET_ARG" ] && RSYNC_ARG="-v" || RSYNC_ARG=""
|
||||||
|
rsync -a $RSYNC_ARG debian/ $BDIR/debian/
|
||||||
|
|
||||||
|
echo "Download forgejo-runner binary..."
|
||||||
|
[ -n "$QUIET_ARG" ] && CURL_ARG="--silent" || CURL_ARG=""
|
||||||
|
curl $CURL_ARG --location -o $BDIR/forgejo-runner \
|
||||||
|
https://code.forgejo.org/forgejo/runner/releases/download/v$VERSION/forgejo-runner-$VERSION-linux-amd64
|
||||||
|
|
||||||
|
echo "Generate forgejo-runner configuration example file..."
|
||||||
|
chmod 755 $BDIR/forgejo-runner
|
||||||
|
$BDIR/forgejo-runner generate-config > $BDIR/config.yml
|
||||||
|
|
||||||
|
echo "Adjust forgejo configuration file..."
|
||||||
|
sed -i 's#^\( *file:\).*#\1 /etc/forgejo-runner/.runner#' $BDIR/config.yml
|
||||||
|
sed -i 's#^\( *dir:\).*#\1 /var/cache/forgejo-runner#' $BDIR/config.yml
|
||||||
|
sed -i 's|^\( *\)envs:.*|\1# envs:|' $BDIR/config.yml
|
||||||
|
sed -i 's|^\( *\)\( A_TEST_ENV.*\)|\1# \2|' $BDIR/config.yml
|
||||||
|
|
||||||
|
if [ -z "$DEBIAN_CODENAME" ]
|
||||||
|
then
|
||||||
|
echo "Retreive 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 forgejo-runner \
|
||||||
|
--version "${VERSION}" \
|
||||||
|
--code-name $DEBIAN_CODENAME \
|
||||||
|
--output $BDIR/debian/changelog \
|
||||||
|
--release-notes dist/release_notes.md \
|
||||||
|
"${GITDCH_ARGS[@]}"
|
||||||
|
|
||||||
|
BUILD_ARGS=""
|
||||||
|
if [ -n "$MAINTAINER_NAME" -a -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
|
||||||
|
else
|
||||||
|
echo "Maintainer email not found in environment, disable signing."
|
||||||
|
BUILD_ARGS="--no-sign"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Build debian package..."
|
||||||
|
cd $BDIR
|
||||||
|
dpkg-buildpackage $BUILD_ARGS
|
||||||
|
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
11
|
14
debian/control
vendored
Normal file
14
debian/control
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Source: forgejo-runner
|
||||||
|
Section: admin
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Debian Zionetrix - forgejo-runner <debian+forgejo-runner@zionetrix.net>
|
||||||
|
Build-Depends: debhelper (>> 11.0.0), curl, lsb-release, git, rsync, gitdch, sed
|
||||||
|
Standards-Version: 3.9.6
|
||||||
|
|
||||||
|
Package: forgejo-runner
|
||||||
|
Architecture: amd64
|
||||||
|
Depends: ${misc:Depends}
|
||||||
|
Description: Forgejo runner daemon
|
||||||
|
Forgejo is a self-hosted lightweight software forge.
|
||||||
|
This package contain a daemon that connects to a Forgejo instance and runs jobs for
|
||||||
|
continous integration.
|
30
debian/copyright
vendored
Normal file
30
debian/copyright
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
This package was debianized by Benjamin Renard <brenard@zionetrix.net>
|
||||||
|
on Sun, 10 Mar 2024 11:48:52 +0100.
|
||||||
|
|
||||||
|
Copyright:
|
||||||
|
|
||||||
|
Copyright (c) 2023 The Forgejo Authors
|
||||||
|
Copyright (c) 2022 The Gitea Authors
|
||||||
|
|
||||||
|
License:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
The Debian packaging is (C) 2024, Benjamin Renard and
|
||||||
|
is licensed under the GPL version 3, see '/usr/share/common-licenses/GPL-3'.
|
2
debian/forgejo-runner.install
vendored
Normal file
2
debian/forgejo-runner.install
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
forgejo-runner usr/bin/
|
||||||
|
config.yml etc/forgejo-runner/
|
50
debian/forgejo-runner.preinst
vendored
Normal file
50
debian/forgejo-runner.preinst
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SERVER_HOME=/var/cache/forgejo-runner
|
||||||
|
SERVER_USER=forgejo-runner
|
||||||
|
SERVER_NAME="Forgejo runner"
|
||||||
|
SERVER_GROUP=forgejo-runner
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
install|upgrade)
|
||||||
|
|
||||||
|
# Create group if not existing
|
||||||
|
if ! getent group | grep -q "^$SERVER_GROUP:" ; then
|
||||||
|
echo -n "Adding group $SERVER_GROUP..."
|
||||||
|
addgroup --quiet --system $SERVER_GROUP 2>/dev/null ||true
|
||||||
|
echo " done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create homedir if not existing
|
||||||
|
test -d $SERVER_HOME || mkdir $SERVER_HOME
|
||||||
|
|
||||||
|
# Create user if not existing
|
||||||
|
if ! getent passwd | grep -q "^$SERVER_USER:"; then
|
||||||
|
echo -n "Adding system user $SERVER_USER..."
|
||||||
|
adduser --quiet \
|
||||||
|
--system \
|
||||||
|
--ingroup $SERVER_GROUP \
|
||||||
|
--home $SERVER_HOME \
|
||||||
|
--no-create-home \
|
||||||
|
--disabled-password \
|
||||||
|
$SERVER_USER 2>/dev/null || true
|
||||||
|
echo " done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adjust file and directory permissions
|
||||||
|
if ! dpkg-statoverride --list $SERVER_HOME >/dev/null
|
||||||
|
then
|
||||||
|
chown -R $SERVER_USER:adm $SERVER_HOME
|
||||||
|
chmod u=rwx,g=rxs,o= $SERVER_HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add user to docker group (if exists)
|
||||||
|
if getent group docker >/dev/null
|
||||||
|
then
|
||||||
|
adduser $SERVER_USER docker
|
||||||
|
fi
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#DEBHELPER#
|
16
debian/forgejo-runner.service
vendored
Normal file
16
debian/forgejo-runner.service
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Forgejo Runner
|
||||||
|
After=syslog.target
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
RestartSec=2s
|
||||||
|
Type=simple
|
||||||
|
User=forejo-runner
|
||||||
|
Group=forgejo-runner
|
||||||
|
WorkingDirectory=/var/cache/forgejo-runner/
|
||||||
|
ExecStart=/usr/bin/forgejo-runner daemon --config /etc/forgejo-runner/config.yml
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.targe
|
5
debian/rules
vendored
Executable file
5
debian/rules
vendored
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/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
|
1
last_release.txt
Normal file
1
last_release.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
3.3.0
|
33
publish_new_release.sh
Executable file
33
publish_new_release.sh
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ROOT_DIR=$( dirname $( realpath $0 ) )
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
LATEST="$1"
|
||||||
|
|
||||||
|
if [ -z "$LATEST" ]
|
||||||
|
then
|
||||||
|
echo -n "Getting latest release..."
|
||||||
|
LATEST=$( curl --silent https://code.forgejo.org/forgejo/runner/tags.rss|xq -x '/rss/channel/item[1]/title'|sed 's/^v//' )
|
||||||
|
echo done.
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Latest release: $LATEST"
|
||||||
|
[ -n "$( git tag -l "$LATEST" )" ] && echo "Release $LATEST already exists" && exit 1
|
||||||
|
|
||||||
|
echo "Press [enter] to create and publish this new release"
|
||||||
|
read
|
||||||
|
|
||||||
|
echo "Create new release..."
|
||||||
|
cd $ROOT_DIR
|
||||||
|
echo -n "$LATEST" > last_release.txt
|
||||||
|
git add last_release.txt
|
||||||
|
git commit -m "Release $LATEST"
|
||||||
|
git tag "$LATEST"
|
||||||
|
echo done.
|
||||||
|
|
||||||
|
echo "Publish new release..."
|
||||||
|
git push
|
||||||
|
git push --tags
|
||||||
|
echo done.
|
Loading…
Reference in a new issue