diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml new file mode 100644 index 0000000..c0bbc45 --- /dev/null +++ b/.forgejo/workflows/release.yaml @@ -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: ${{ secrets.MAINTAINER_NAME }} + MAINTAINER_EMAIL: ${{ secrets.MAINTAINER_EMAIL }} + DEBIAN_CODENAME: ${{ secrets.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: publish-release-notes + shell: bash + run: | + mkdir release + mv *.deb release/ + cat << EOF >> "$GITHUB_OUTPUT" + value< /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