From a739303041096ce821f00bd7b9131d571418ca89 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 6 Aug 2023 22:21:22 +0200 Subject: [PATCH] Added build-ui step to the Drone pipeline. --- .drone.yml | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/.drone.yml b/.drone.yml index f84a3109b..f3eb3a5b0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -73,6 +73,69 @@ steps: - apk del build-base g++ rust - pytest tests +- name: build-ui + image: node:current-alpine3.18 + + environment: + SSH_PUBKEY: + from_secret: ssh_pubkey + SSH_PRIVKEY: + from_secret: ssh_privkey + PGP_KEY: + from_secret: pgp_key + PGP_KEY_ID: + from_secret: pgp_key_id + + when: + branch: + - master + event: + - push + + depends_on: + - tests + + commands: + - apk add --update --no-cache git + - git config --global --add safe.directory $PWD + - cd platypush/backend/http/webapp + - | + if [ $(git log --pretty=oneline $DRONE_COMMIT_AFTER...$DRONE_COMMIT_BEFORE . | wc -l) -eq 0 ]; then + echo "No UI changes detected, skipping build" + exit 0 + fi + + - npm install + - npm run build + - | + if [ $(git status --porcelain dist | wc -l) -eq 0 ]; then + echo "No build files have been changed" + exit 0 + fi + + - apk add --update --no-cache bash gnupg openssh + - mkdir -p ~/.ssh + - | + cat < ~/.ssh/id_rsa.pub + - | + cat < ~/.ssh/id_rsa + $SSH_PRIVKEY + EOF + - chmod 0600 ~/.ssh/id_rsa + - ssh-keyscan git.platypush.tech >> ~/.ssh/known_hosts 2>/dev/null + + - git config --global commit.gpgsign true + - git config user.name "Platypush CI/CD Automation" + - git config user.email "admin@platypush.tech" + - git config user.signingkey $PGP_KEY_ID + - git add dist + - git commit dist -S -m "[Automatic] Updated UI files" --no-verify + - git push origin master + - name: update-arch-packages image: python:3.11-alpine environment: @@ -85,9 +148,12 @@ steps: when: branch: - master + event: + - push depends_on: - tests + - build-ui commands: - echo "-- Installing dependencies" @@ -222,6 +288,7 @@ steps: depends_on: - tests + - build-ui - update-arch-packages commands: