From 2c748683154ccbabe78d27b5d1ef07e0927cdee4 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 18 Sep 2023 11:00:46 +0200 Subject: [PATCH] [#323] Added logic to create deb package --- .drone.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index cdcd4b2a95..1461a2af6d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -179,7 +179,7 @@ steps: - git config --global --add safe.directory $PWD - git pull --rebase origin master --tags - export VERSION=$(python setup.py --version) - - export HEAD=$(git log | head -1 | awk '{printf "%.8s", $2}') + - export HEAD=$(git log --pretty=format:%h HEAD...HEAD~1) - export GIT_VERSION="$VERSION.r$(git log --pretty=oneline HEAD...v$VERSION | wc -l).$HEAD" - export TAG_URL="https://git.platypush.tech/platypush/platypush/archive/v$VERSION.tar.gz" - export TAG_ARCHIVE="platypush-$VERSION.tar.gz" @@ -244,6 +244,56 @@ steps: git push origin master fi +- name: update-debian-packages + image: python:3.11-bookworm + environment: + WORKDIR: /tmp/workdir + STABLE_PKG_NAME: platypush + GIT_PKG_NAME: platypush-git + AWS_ENDPOINT_URL: https://s3.nl-ams.scw.cloud + AWS_ACCESS_KEY_ID: aws_access_key_id + + when: + branch: + - master + event: + - push + + depends_on: + - build-ui + + commands: + - echo "-- Installing dependencies" + - apt update + - apt install -y dpkg-dev gpg + - pip install awscli + + - echo "--- Parsing metadata" + - git config --global --add safe.directory $PWD + - git pull --rebase origin master --tags + - export VERSION=$(python setup.py --version) + - export HEAD=$(git log --pretty=format:%h HEAD...HEAD~1) + - export GIT_VERSION="$VERSION.r$(git log --pretty=oneline HEAD...v$VERSION | wc -l).$HEAD" + - export TAG_URL="https://git.platypush.tech/platypush/platypush/archive/v$VERSION.tar.gz" + - export TAG_ARCHIVE="platypush-$VERSION.tar.gz" + - export GIT_BUILD_DIR="${WORKDIR}/${GIT_PKG_NAME}_${GIT_VERSION}_all" + - export PKGNAME="${PWD}/${GIT_PKG_NAME}_${GIT_VERSION}.deb" + + - echo "--- Building git package" + - python setup.py install --prefix="$GIT_BUILD_DIR" --no-deps + - mkdir "${GIT_BUILD_DIR}/DEBIAN" + - | + cat < "${GIT_BUILD_DIR}/DEBIAN/control" + Package: $GIT_PKG_NAME + Version: $GIT_VERSION + Maintainer: Fabio Manganiello + Depends: $(cat platypush/install/requirements/debian.txt | tr '\n' ' ') + Architecture: all + Homepage: https://platypush.tech + Description: Universal command executor and automation hub. + - dpkg --build "$GIT_BUILD_DIR" + - aws s3 cp "$PKGNAME" s3://platypush-static/deb/git/ + - name: update-pip-package image: python:3.11-alpine environment: @@ -278,6 +328,7 @@ steps: depends_on: - update-pip-package - update-arch-packages + - update-debian-packages commands: - apk add --update --no-cache curl @@ -303,6 +354,7 @@ steps: depends_on: - update-arch-packages + - update-debian-packages commands: - apk add --update --no-cache curl