2024-11-15 23:35:39 +03:00
|
|
|
|
name: "Build and Deploy Test Version (with/without Drafts) - next.asandikci.com"
|
2020-07-28 21:27:40 +03:00
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches:
|
2022-08-14 00:47:30 +03:00
|
|
|
|
- main
|
2020-07-28 21:27:40 +03:00
|
|
|
|
paths-ignore:
|
2020-10-03 11:45:17 +03:00
|
|
|
|
- .gitignore
|
|
|
|
|
- README.md
|
|
|
|
|
- LICENSE
|
2022-08-14 00:47:30 +03:00
|
|
|
|
workflow_dispatch:
|
2020-07-28 21:27:40 +03:00
|
|
|
|
|
2022-08-14 00:47:30 +03:00
|
|
|
|
permissions:
|
|
|
|
|
contents: read
|
|
|
|
|
pages: write
|
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
|
|
# Allow one concurrent deployment
|
|
|
|
|
concurrency:
|
|
|
|
|
group: "pages"
|
|
|
|
|
cancel-in-progress: true
|
2020-10-07 18:53:05 +03:00
|
|
|
|
|
2022-08-14 00:47:30 +03:00
|
|
|
|
jobs:
|
2024-11-15 23:35:39 +03:00
|
|
|
|
build-and-push-prod:
|
2024-10-30 01:55:10 +03:00
|
|
|
|
runs-on: docker
|
2024-11-11 23:31:10 +03:00
|
|
|
|
container:
|
2024-11-15 18:48:01 +03:00
|
|
|
|
image: git.asandikci.com/docker-images/website_builder:latest
|
|
|
|
|
steps:
|
2024-11-13 22:04:46 +03:00
|
|
|
|
- name: Git Clone
|
2024-11-13 21:27:27 +03:00
|
|
|
|
run: |
|
|
|
|
|
git clone https://git.asandikci.com/asandikci.com/web
|
2024-11-13 21:33:36 +03:00
|
|
|
|
ls -la ./web
|
2024-11-10 23:44:06 +03:00
|
|
|
|
|
2024-11-12 00:50:23 +03:00
|
|
|
|
- name: Build Site
|
|
|
|
|
run: |
|
2024-11-13 21:33:36 +03:00
|
|
|
|
cd web
|
2024-11-12 00:50:23 +03:00
|
|
|
|
bundle install
|
2024-11-15 23:35:39 +03:00
|
|
|
|
bundle exec jekyll b
|
2024-11-12 00:50:23 +03:00
|
|
|
|
env:
|
2024-11-15 22:57:54 +03:00
|
|
|
|
JEKYLL_ENV: "production"
|
2024-11-13 22:04:46 +03:00
|
|
|
|
|
|
|
|
|
- name: Push to "website" branch
|
|
|
|
|
run: |
|
2024-11-13 23:27:34 +03:00
|
|
|
|
mkdir website_branch && cd website_branch
|
|
|
|
|
git clone https://git.asandikci.com/asandikci.com/web
|
|
|
|
|
cd web
|
|
|
|
|
git checkout website
|
2024-11-15 23:35:39 +03:00
|
|
|
|
rm -rfv ./_site/
|
2024-11-15 17:38:59 +03:00
|
|
|
|
cp -rfv ../../web/_site .
|
2024-11-13 23:39:10 +03:00
|
|
|
|
git config --global user.name "Aliberk Sandıkçı (CI)"
|
|
|
|
|
git config --global user.email git+ci@asandikci.com
|
2024-11-13 23:27:34 +03:00
|
|
|
|
git add -A
|
2024-11-15 22:57:54 +03:00
|
|
|
|
git commit --all --message "Updated! [CI]"
|
|
|
|
|
git push https://asandikci:${{ secrets.PUSH_KEY }}@git.asandikci.com/asandikci.com/web
|
2024-11-13 23:27:34 +03:00
|
|
|
|
|
2024-11-15 23:35:39 +03:00
|
|
|
|
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/"
|
|
|
|
|
|
2024-11-13 22:10:36 +03:00
|
|
|
|
- name: Checkout & Deploy
|
|
|
|
|
run: |
|
2024-11-13 22:15:36 +03:00
|
|
|
|
mkdir deploy && cd deploy
|
2024-11-13 22:10:36 +03:00
|
|
|
|
git clone https://git.asandikci.com/asandikci.com/web
|
|
|
|
|
cd web
|
|
|
|
|
git checkout website
|
2024-11-15 20:48:49 +03:00
|
|
|
|
cd _site
|
|
|
|
|
echo '${{ secrets.SFTP_PASSWORD }}' > ~/.passwd
|
|
|
|
|
chmod 0400 ~/.passwd
|
2024-11-13 22:10:36 +03:00
|
|
|
|
sshpass -f ~/.passwd sftp -oBatchMode=no -o StrictHostKeyChecking=accept-new -b - ${{ secrets.SFTP_USERNAME }}@${{ vars.SFTP_HOST }} << !
|
2024-11-15 23:35:39 +03:00
|
|
|
|
rm www/*
|
2024-11-13 22:10:36 +03:00
|
|
|
|
put -r . www/
|
|
|
|
|
bye
|
2024-11-15 22:57:54 +03:00
|
|
|
|
!
|