From 673fa4c82898f38f1dfe2c7ca87897b0b8295975 Mon Sep 17 00:00:00 2001 From: Sohrab Behdani Date: Mon, 16 Sep 2024 11:53:40 +0330 Subject: [PATCH] updated build file with ssh and rsync --- .gitlab-ci.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e48186..f13db04 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,27 +1,32 @@ stages: - build - - release + - deploy image: archlinux/archlinux:base-devel +variables: + Desktop: "Cosmic" # Change this value to your desired desktop environment + archiso: stage: build script: - ./build.sh + - echo "Renaming the output ISO file" + - mv out/*.iso out/ParchLinux-$Desktop-latest.iso rules: - if: $CI_COMMIT_TAG -release: - stage: release +deploy: + stage: deploy script: - - echo "Creating GitLab release for tag $CI_COMMIT_TAG" - - | - curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" \ - --data "name=Release $CI_COMMIT_TAG&tag_name=$CI_COMMIT_TAG&ref=$CI_COMMIT_SHA" \ - --upload-file "out/*.iso" \ - "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases" + - echo "Installing sshpass" + - pacman -Syu --noconfirm sshpass + - echo "Deleting old ISO files from remote directory" + - sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no parch@$SSH_ROOT "rm -f /srv/http/cosmic/*.iso" + - echo "Deploying new ISO via rsync" + - sshpass -p "$PASS" rsync -avz -e "ssh -o StrictHostKeyChecking=no" out/ParchLinux-$Desktop-latest.iso parch@$SSH_ROOT:/srv/http/cosmic/ rules: - if: $CI_COMMIT_TAG dependencies: - - archiso + - archiso