Drop CI/CD here

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2023-10-18 22:37:07 +05:30
parent 3278e16057
commit 942b4a3bda
Signed by: baalajimaestro
GPG Key ID: F93C394FE9BBAFD5
3 changed files with 0 additions and 72 deletions

View File

@ -1,18 +0,0 @@
#! /bin/sh
apk add git python3 py3-gitpython openssh-client
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "Setting Host Keys for GitLab...."
echo '[git.baalajimaestro.me]:29999 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3IrYRuprw3liGd+/EGLBFqxQ9S2+/1FNxNCpO87wjRIpDxZjAWOvT2tUoIEUzWEGNHqkgRLn+rR0hsGK0SqHIPyEIsJ5AKuS7zuhy6fkVS7RsDHjJ8usBF4j3EnkYBse5qLgUIf37u0mF0EXAFcuwOBgvXM6hqL0UYcQqRGWWrHvkRRcmizkAcxJcframf3+PLG/vn4fSUH7ZUUqjx6/QIJS0iFb0HB2mv8sWzpJlJmy46WZVltwPDLOLeGZb4OcAB20/yfPalb4MsQeSrVmYtRos3sN8Uh/DwfNT/u5Jk6qqXHm3GW2fzsbZInb+0XjrmdaH3awhUN0vQMDvYgvR2UcZHgRuJvKXMAo3keOA8m9cBXJvopr/TyKt4GUvIGzjXUB9kyW/sIxn6qJel8y3b486FxV1EI2m9wKzFbtRdRG1xWxjTR16LyerrzwgAaAayFxyuQ6UgvM4zCzdgk6cDT2hGfHhF2NUKiWDobGowQJairVCzaYZCT/jy9avm2M=' >> ~/.ssh/known_hosts
echo '[git.baalajimaestro.me]:29999 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL0yV054Ox/OPWCAz6hzo6VKkugDJx7ziCQBAdjhWfTTK3YCYroPANtflimBZYNhl43OyUx0mbdh8W27+T/PXBU=' >> ~/.ssh/known_hosts
echo '[git.baalajimaestro.me]:29999 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHJWhNlVfjAqfnHGqtqudlRZ8IBD8gt2XJUvBBAI6+5K' >> ~/.ssh/known_hosts
git config --global user.name baalajimaestro
git config --global user.email me@baalajimaestro.me
export HUGO_ENV=production
python3 .buildpush.py

View File

@ -1,47 +0,0 @@
# Imports
from git import Repo
import subprocess
import os
from time import time
from pathlib import Path
# All the env vars
content_repo_git = os.environ.get("CONTENT_REPO_GIT")
out_dir = os.environ.get("OUT_DIR")
# Find absolute path of current directory
cwd = os.getcwd()
path = Path(cwd)
base_dir = str(path)
current_time = str(int(time()))
# Set SSH Key path
git_ssh_cmd = "ssh -i /tmp/ssh-key"
# Clone our content
content_repo = Repo.clone_from(
f"ssh://git@git.baalajimaestro.me:29999/baalajimaestro/{content_repo_git}.git",
f"{base_dir}/content",
branch="prod",
env=dict(GIT_SSH_COMMAND=git_ssh_cmd)
)
# Initialise the repo for our out directory and add the base repo as remote
os.mkdir(out_dir)
os.chdir(out_dir)
repo = Repo.init(out_dir)
repo.create_remote(
"origin",
f"ssh://git@git.baalajimaestro.me:29999/baalajimaestro/personal-website.git",
)
# Build the binaries
os.chdir(base_dir)
process = subprocess.run(["hugo", "--gc", "--minify", "-d", out_dir])
# Switch to out directory and push it up
os.chdir(out_dir)
repo.git.add(".")
repo.index.commit(f"[MaestroCI]: Binaries as of {current_time}")
repo.git.push("origin", "master", force=True, env=dict(GIT_SSH_COMMAND=git_ssh_cmd))

View File

@ -1,7 +0,0 @@
build-and-push:
stage: build
before_script:
- chmod 600 $SSH_SECRET_KEY
script:
- docker run -v $(pwd):/app -w /app -v "$SSH_SECRET_KEY":/tmp/ssh-key -e CONTENT_REPO_GIT="$CONTENT_REPO_GIT" -e OUT_DIR="$OUT_DIR" registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest sh .build.sh
- docker run -v $(pwd):/app busybox rm -rf /app/content /app/resources