HypatiaDatabases/.forgejo/workflows/generate_website.yml

67 lines
2.8 KiB
YAML
Raw Permalink Normal View History

2025-01-23 20:13:14 +03:00
name: "Generate Databases and Publish to Website (hypatia.services.yayindasin.org)"
on:
workflow_dispatch:
jobs:
build-and-push-prod:
runs-on: docker
container:
image: git.asandikci.com/docker-images/website_builder:latest # actually no need to new image?
2025-01-26 20:54:12 +00:00
steps:
2025-01-23 20:13:14 +03:00
- name: Git Clone
run: |
git clone https://git.asandikci.com/MaintainTeam/HypatiaDatabases.git
cd HypatiaDatabases
ls -la
2025-01-26 20:54:12 +00:00
2025-01-23 20:13:14 +03:00
# - name: Generate Databases
# run: |
# cd scripts
2025-01-26 20:54:12 +00:00
# bash generate databases.sh #
# NOTE : I generated database files in docker in my computer locally. (Created a maven project and run Main.java)
# After I completely understand the scripts and generation process I'll add this steps/files to this repo/CI
2025-01-23 20:13:14 +03:00
#
# assume this step generates all files to databases/generated/ directory, for now I am using old_generated_files_for_test/ directory, change this later
2025-01-26 20:54:12 +00:00
2025-01-23 20:13:14 +03:00
- name: Push Databases to "static" branch
run: |
mkdir static && cd static
git clone https://git.asandikci.com/MaintainTeam/HypatiaDatabases.git
cd HypatiaDatabases
git checkout static
rm -rfv ./databases/
mkdir databases
2025-01-26 20:54:12 +00:00
cp -rfv ../../HypatiaDatabases/production/* ./databases/
2025-01-23 20:13:14 +03:00
git config --global user.name "Aliberk Sandıı (CI)"
git config --global user.email git+ci@asandikci.com
git add -A
git commit --all --message "Updated Databases! [CI]"
git push https://asandikci:${{ secrets.PUSH_KEY }}@git.asandikci.com/MaintainTeam/HypatiaDatabases
# is it really safe to pushing inside a CI ???
### Hey I don't even give PUSH_KEY variable, how does it push lol ?
### FIXME: !!!
publish:
runs-on: docker
container:
image: git.asandikci.com/docker-images/website_builder:latest # actually no need to new image?
steps:
- name: Checkout & Deploy
run: |
git clone https://git.asandikci.com/MaintainTeam/HypatiaDatabases.git
cd HypatiaDatabases
git checkout static
date >> info.txt
echo '${{ secrets.SFTP_PASSWORD }}' > ~/.passwd
chmod 0400 ~/.passwd
sshpass -f ~/.passwd sftp -oBatchMode=no -o StrictHostKeyChecking=accept-new -b - ${{ secrets.SFTP_USERNAME }}@hypatia.services.yayindasin.org << !
bye
!
lftp --user ${{ secrets.SFTP_USERNAME }} --password ${{ secrets.SFTP_PASSWORD }} sftp://hypatia.services.yayindasin.org -e "mirror -R --delete . www/"
## TODO: see https://git.asandikci.com/asandikci.com/web/issues/10 for ftp related ...
# CURRENTLY USING PURE STFP FOR AUTH ONLY
2025-01-26 20:54:12 +00:00
# TODO: CHANGE THIS