updated build file with ssh and rsync

This commit is contained in:
Sohrab Behdani 2024-09-16 11:53:40 +03:30
parent 9adc5d14a9
commit 673fa4c828

View file

@ -1,25 +1,30 @@
stages: stages:
- build - build
- release - deploy
image: archlinux/archlinux:base-devel image: archlinux/archlinux:base-devel
variables:
Desktop: "Cosmic" # Change this value to your desired desktop environment
archiso: archiso:
stage: build stage: build
script: script:
- ./build.sh - ./build.sh
- echo "Renaming the output ISO file"
- mv out/*.iso out/ParchLinux-$Desktop-latest.iso
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
release: deploy:
stage: release stage: deploy
script: script:
- echo "Creating GitLab release for tag $CI_COMMIT_TAG" - echo "Installing sshpass"
- | - pacman -Syu --noconfirm sshpass
curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" \ - echo "Deleting old ISO files from remote directory"
--data "name=Release $CI_COMMIT_TAG&tag_name=$CI_COMMIT_TAG&ref=$CI_COMMIT_SHA" \ - sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no parch@$SSH_ROOT "rm -f /srv/http/cosmic/*.iso"
--upload-file "out/*.iso" \ - echo "Deploying new ISO via rsync"
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases" - sshpass -p "$PASS" rsync -avz -e "ssh -o StrictHostKeyChecking=no" out/ParchLinux-$Desktop-latest.iso parch@$SSH_ROOT:/srv/http/cosmic/
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
dependencies: dependencies: