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,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