Compare commits
2 commits
e44ade3113
...
539c27272b
Author | SHA1 | Date | |
---|---|---|---|
539c27272b | |||
5dbe278251 |
4 changed files with 132 additions and 59 deletions
83
.forgejo/workflows/release.yaml
Normal file
83
.forgejo/workflows/release.yaml
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
---
|
||||||
|
name: Build and publish forgejo 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: "forgejo"
|
|
@ -1,55 +0,0 @@
|
||||||
clone:
|
|
||||||
git:
|
|
||||||
image: woodpeckerci/plugin-git
|
|
||||||
tags: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
build:
|
|
||||||
image: brenard/debian-python-deb
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
commands:
|
|
||||||
- echo "$GPG_KEY"|base64 -d|gpg --import
|
|
||||||
- ./build.sh --quiet
|
|
||||||
secrets: [ maintainer_name, maintainer_email, gpg_key, debian_codename ]
|
|
||||||
|
|
||||||
publish-dryrun:
|
|
||||||
group: publish
|
|
||||||
image: alpine
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
commands:
|
|
||||||
- ls dist/*
|
|
||||||
|
|
||||||
publish-gitea:
|
|
||||||
group: publish
|
|
||||||
image: plugins/gitea-release
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
settings:
|
|
||||||
api_key:
|
|
||||||
from_secret: gitea_token
|
|
||||||
base_url: https://gitea.zionetrix.net
|
|
||||||
note: dist/release_notes.md
|
|
||||||
files:
|
|
||||||
- dist/*.deb
|
|
||||||
checksum:
|
|
||||||
- md5
|
|
||||||
- sha512
|
|
||||||
|
|
||||||
publish-apt:
|
|
||||||
group: publish
|
|
||||||
image: brenard/aptly-publish
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
settings:
|
|
||||||
api_url:
|
|
||||||
from_secret: apt_api_url
|
|
||||||
api_username:
|
|
||||||
from_secret: apt_api_username
|
|
||||||
api_password:
|
|
||||||
from_secret: apt_api_password
|
|
||||||
repo_name:
|
|
||||||
from_secret: apt_repo_name
|
|
||||||
path: dist
|
|
||||||
source_name: forgejo
|
|
42
build.sh
42
build.sh
|
@ -1,11 +1,51 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
DEBUG=0
|
||||||
|
INSTALL_DEPS=0
|
||||||
QUIET_ARG=""
|
QUIET_ARG=""
|
||||||
[ "$1" == "--quiet" ] && QUIET_ARG="--quiet"
|
|
||||||
|
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
|
# Enter source directory
|
||||||
cd $( dirname $0 )
|
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..."
|
echo "Clean previous build..."
|
||||||
rm -fr dist
|
rm -fr dist
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,14 @@ ROOT_DIR=$( dirname $( realpath $0 ) )
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo -n "Getting latest release..."
|
LATEST="$1"
|
||||||
LATEST=$( curl --silent https://forgejo.org/releases/rss.xml|xq '.rss.channel.item[0].title'|tr -d '"'|sed 's/^v//' )
|
|
||||||
echo done.
|
if [ -z "$LATEST" ]
|
||||||
|
then
|
||||||
|
echo -n "Getting latest release..."
|
||||||
|
LATEST=$( curl --silent https://forgejo.org/releases/rss.xml|xq -x '/rss/channel/item[1]/title'|sed 's/^v//' )
|
||||||
|
echo done.
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Latest release: $LATEST"
|
echo "Latest release: $LATEST"
|
||||||
[ -n "$( git tag -l "$LATEST" )" ] && echo "Release $LATEST already exists" && exit 1
|
[ -n "$( git tag -l "$LATEST" )" ] && echo "Release $LATEST already exists" && exit 1
|
||||||
|
|
Loading…
Reference in a new issue