diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..5ba1bfa --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,36 @@ +stages: + - build + - deploy + +image: archlinux/archlinux:base-devel + +variables: + Desktop: "cosmic" + +build_iso: + stage: build + script: + - ./build.sh + - echo "Renaming the output ISO file" + - mv out/*.iso out/ParchLinux-cosmic-latest.iso + artifacts: + paths: + - out/ParchLinux-cosmic-latest.iso + rules: + - if: $CI_COMMIT_TAG + +deploy_iso: + stage: deploy + dependencies: + - build_iso + script: + - echo "Installing sshpass and rsync" + - pacman -Syu --noconfirm sshpass rsync + - echo "Removing old ISO files from remote directory" + - sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no parch@$SSH_ROOT rm -rf /srv/http/cosmic/ + - echo "Creating new directory on remote host" + - sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no parch@$SSH_ROOT mkdir -p /srv/http/cosmic/ + - echo "Uploading new ISO via rsync" + - sshpass -p "$PASS" rsync -r out/ParchLinux-cosmic-latest.iso parch@$SSH_ROOT:/srv/http/cosmic/ + rules: + - if: $CI_COMMIT_TAG diff --git a/build.sh b/build.sh index c865e6e..c94473d 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ main() { set -e local Black DarkGray Red LightRed Green LightGreen Brown Yellow Blue LightBlue Purple Light Purple Cyan LightCyan LightGray White reset - ## save colors + ## Save colors Black="\e[0;30m" DarkGray="\e[1;30m" Red="\e[0;31m" @@ -23,38 +23,35 @@ main() { local reponame reponame=${PWD##*/} - echo -e "$Green### start install packeges for build $reponame ###$reset" - echo -e "$Brown### checking your os ###$reset" + echo -e "$Green### Start install packages for build $reponame ###$reset" + echo -e "$Brown### Checking your OS ###$reset" if type pacman >/dev/null 2>&1;then if [ "$(id -u)" != "0" ]; then - echo -e "$Red### you are not in root$reset" + echo -e "$Red### You are not in root$reset" exit 1 else install - echo -e "$Blue### install complete ###$reset" - echo -e "$Green### start build $reponame with archiso ###$reset" - build - makezip + echo -e "$Blue### Install complete ###$reset" + echo -e "$Green### Start build $reponame with archiso ###$reset" + build fi else - echo -e "$Red###os cant supported###$reset" + echo -e "$Red###OS can't supported###$reset" exit 1 fi } + install() { set -e - pacman -Sy; pacman --noconfirm -S --needed git archiso github-cli p7zip + pacman -Sy; pacman --noconfirm -S --needed git archiso github-cli p7zip reflector rsync } + + build() { set -e mkarchiso -v iso/ } -makezip() { - cd out - 7z -v500m a "$(ls *.iso)".zip "$(ls *.iso)" - md5sum * > md5sums.txt -} main