image: node:14 stages: - prepare - build - test - packaging - deploy cache: key: ${CI_COMMIT_REF_SLUG} paths: - .npm/ - node_modules/ include: - template: Code-Quality.gitlab-ci.yml variables: SAST_DISABLE_DIND: "true" Node_dependencies: stage: prepare script: - npm ci --cache .npm --prefer-offline Minimize: stage: build script: - npm run build artifacts: expire_in: 7 days paths: - build/ needs: ["Node_dependencies"] Frontend_Tests: stage: test script: - npm run test artifacts: reports: junit: - ./junit.xml needs: ["Node_dependencies"] code_quality: tags: - dind Debian_Server: stage: packaging image: debian script: - vers=$(grep -Po '"version":.*?[^\\]",' package.json | grep -Po '[0-9]+\.[0-9]+\.[0-9]+') # parse the version out of package .json - cd deb - mkdir -p "./OpenMediaCenter/var/www/openmediacenter/videos/" - mkdir -p "./OpenMediaCenter/tmp/" - cp -r ../build/* ./OpenMediaCenter/var/www/openmediacenter/ - cp -r ../api ./OpenMediaCenter/var/www/openmediacenter/ - cp ../database.sql ./OpenMediaCenter/tmp/openmediacenter.sql - 'echo "Version: ${vers}" >> ./OpenMediaCenter/DEBIAN/control' - chmod -R 0775 * - dpkg-deb --build OpenMediaCenter - mv OpenMediaCenter.deb OpenMediaCenter-${vers}_amd64.deb artifacts: paths: - deb/OpenMediaCenter-*.deb needs: ["Minimize"] Electron_Client: stage: packaging image: electronuserland/builder:wine script: - npm run buildlinux - npm run buildwin artifacts: expire_in: 2 days paths: - dist/*.rpm - dist/*.deb - dist/*.exe needs: ["Minimize"] Test_Server: stage: deploy image: luki42/alpineopenssh:latest needs: - Frontend_Tests - Debian_Server only: - master script: - eval $(ssh-agent -s) - ssh-add <(echo "$SSH_PRIVATE_KEY") - mkdir -p ~/.ssh - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' - scp deb/OpenMediaCenter-*.deb root@192.168.0.42:/tmp/ - ssh root@192.168.0.42 "DEBIAN_FRONTEND=noninteractive apt-get --reinstall -y -qq install /tmp/OpenMediaCenter-*.deb && rm /tmp/OpenMediaCenter-*.deb" allow_failure: true