web/.forgejo/workflows/deploy_prod.yml

67 lines
1.9 KiB
YAML
Raw Permalink Normal View History

2024-11-13 23:03:37 +03:00
name: "Build and Deploy PRODUCTION Version - asandikci.com"
on:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build-and-push-prod:
2024-11-13 23:03:37 +03:00
runs-on: docker
container:
image: git.asandikci.com/docker-images/website_builder:latest
steps:
- name: Git Clone
2024-11-13 23:03:37 +03:00
run: |
git clone https://git.asandikci.com/asandikci.com/web
ls -la ./web
- name: Build Site
run: |
cd web
bundle install
bundle exec jekyll b
env:
JEKYLL_ENV: "production"
2024-11-13 23:03:37 +03:00
- name: Push to "website" branch
run: |
mkdir website_branch && cd website_branch
git clone https://git.asandikci.com/asandikci.com/web
cd web
git checkout website
rm -rfv ./_site/
cp -rfv ../../web/_site .
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! [CI]"
git push https://asandikci:${{ secrets.PUSH_KEY }}@git.asandikci.com/asandikci.com/web
publish:
runs-on: docker
container:
image: git.asandikci.com/docker-images/website_builder:latest
steps:
2024-11-13 23:03:37 +03:00
- name: Checkout & Deploy
run: |
git clone https://git.asandikci.com/asandikci.com/web
cd web
git checkout website
cd _site
echo '${{ secrets.SFTP_PASSWORD_PROD }}' > ~/.passwd
chmod 0400 ~/.passwd
sshpass -f ~/.passwd sftp -oBatchMode=no -o StrictHostKeyChecking=accept-new -b - ${{ secrets.SFTP_USERNAME_PROD }}@${{ vars.SFTP_HOST_PROD }} << !
put -r . www/
bye
!
## TODO: WILL BE REPLACED WITH NEW LFTP SETUP !!!