Update CI
Some checks failed
Build and Deploy Test Version (with/without Drafts) - next.asandikci.com / build-and-push-prod (push) Successful in 1m9s
Build and Deploy Test Version (with/without Drafts) - next.asandikci.com / build-drafts-and-deploy (push) Failing after 1m4s

- Both build with/without drafts
- publish to website branch without-draft build
- deploy to actual website with-draft-build
- remove _site directory while publishing to website branch to prevent caching/collisions
- remove files in www/ directory in actual website to prevent caching/collisions
This commit is contained in:
Aliberk Sandıkçı 2024-11-15 23:35:39 +03:00
parent 771c31cf6c
commit 99dd009236

View file

@ -1,4 +1,4 @@
name: "Build and Deploy Test Version (with Drafts!) - next.asandikci.com"
name: "Build and Deploy Test Version (with/without Drafts) - next.asandikci.com"
on:
push:
branches:
@ -20,7 +20,7 @@ concurrency:
cancel-in-progress: true
jobs:
build_deploy:
build-and-push-prod:
runs-on: docker
container:
image: git.asandikci.com/docker-images/website_builder:latest
@ -34,16 +34,9 @@ jobs:
run: |
cd web
bundle install
bundle exec jekyll b --drafts
bundle exec jekyll b
env:
JEKYLL_ENV: "production"
- name: Test Site
run: |
cd web
bundle exec htmlproofer _site \
\-\-disable-external \
\-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/"
- name: Push to "website" branch
run: |
@ -51,6 +44,7 @@ jobs:
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
@ -58,6 +52,32 @@ jobs:
git commit --all --message "Updated! [CI]"
git push https://asandikci:${{ secrets.PUSH_KEY }}@git.asandikci.com/asandikci.com/web
build-drafts-and-deploy:
runs-on: docker
container:
image: git.asandikci.com/docker-images/website_builder:latest
steps:
- name: Git Clone
run: |
git clone https://git.asandikci.com/asandikci.com/web
ls -la ./web
- name: Build Site (with Drafts!)
run: |
cd web
bundle install
bundle exec jekyll b --drafts
env:
JEKYLL_ENV: "production"
# TODO: WILL BE FIXED
# - name: Test Site
# run: |
# cd web
# bundle exec htmlproofer _site \
# \-\-disable-external \
# \-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/"
- name: Checkout & Deploy
run: |
mkdir deploy && cd deploy
@ -68,6 +88,7 @@ jobs:
echo '${{ secrets.SFTP_PASSWORD }}' > ~/.passwd
chmod 0400 ~/.passwd
sshpass -f ~/.passwd sftp -oBatchMode=no -o StrictHostKeyChecking=accept-new -b - ${{ secrets.SFTP_USERNAME }}@${{ vars.SFTP_HOST }} << !
rm www/*
put -r . www/
bye
!