Update CI
- 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:
parent
771c31cf6c
commit
99dd009236
1 changed files with 31 additions and 10 deletions
|
@ -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,23 +34,17 @@ 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: |
|
||||
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ıkçı (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
|
||||
!
|
Loading…
Reference in a new issue