Added gitlab-ci and updated build script

This commit is contained in:
Sohrab Behdani 2024-09-18 20:07:44 +03:30
parent ce4680d7a5
commit be4c6a6b64
2 changed files with 48 additions and 15 deletions

36
.gitlab-ci.yml Normal file
View file

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

View file

@ -2,7 +2,7 @@
main() { main() {
set -e set -e
local Black DarkGray Red LightRed Green LightGreen Brown Yellow Blue LightBlue Purple Light Purple Cyan LightCyan LightGray White reset 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" Black="\e[0;30m"
DarkGray="\e[1;30m" DarkGray="\e[1;30m"
Red="\e[0;31m" Red="\e[0;31m"
@ -23,38 +23,35 @@ main() {
local reponame local reponame
reponame=${PWD##*/} reponame=${PWD##*/}
echo -e "$Green### start install packeges for build $reponame ###$reset" echo -e "$Green### Start install packages for build $reponame ###$reset"
echo -e "$Brown### checking your os ###$reset" echo -e "$Brown### Checking your OS ###$reset"
if type pacman >/dev/null 2>&1;then if type pacman >/dev/null 2>&1;then
if [ "$(id -u)" != "0" ]; 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 exit 1
else else
install install
echo -e "$Blue### install complete ###$reset" echo -e "$Blue### Install complete ###$reset"
echo -e "$Green### start build $reponame with archiso ###$reset" echo -e "$Green### Start build $reponame with archiso ###$reset"
build build
makezip
fi fi
else else
echo -e "$Red###os cant supported###$reset" echo -e "$Red###OS can't supported###$reset"
exit 1 exit 1
fi fi
} }
install() { install() {
set -e 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() { build() {
set -e set -e
mkarchiso -v iso/ mkarchiso -v iso/
} }
makezip() {
cd out
7z -v500m a "$(ls *.iso)".zip "$(ls *.iso)"
md5sum * > md5sums.txt
}
main main