web/.forgejo/workflows/build_and_test.yml

96 lines
2.8 KiB
YAML
Raw Normal View History

name: "Build and Deploy Test Version (with/without Drafts) - next.asandikci.com"
2020-07-28 21:27:40 +03:00
on:
push:
branches:
- main
2020-07-28 21:27:40 +03:00
paths-ignore:
2020-10-03 11:45:17 +03:00
- .gitignore
- README.md
- LICENSE
workflow_dispatch:
2020-07-28 21:27:40 +03:00
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
2024-11-16 00:12:37 +03:00
# build-and-push-prod:
# 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
2024-11-16 00:12:37 +03:00
# - name: Build Site
# run: |
# cd web
# bundle install
# bundle exec jekyll b
# env:
# JEKYLL_ENV: "production"
2024-11-16 00:12: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
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
2024-11-16 00:12:37 +03:00
ls -la
pwd
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: Deploy
run: |
2024-11-16 00:12:37 +03:00
mkdir deploy && cd deploy
cp -rfv ../web/_site .
2024-11-16 00:31:18 +03:00
cd _site
# CURRENTLY USING PURE STFP FOR AUTH ONLY
# TODO: CHANGE THIS
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 }} << !
bye
!
lftp --user ${{ secrets.SFTP_USERNAME }} --password ${{ secrets.SFTP_PASSWORD }} sftp://${{ vars.SFTP_HOST }} -e "mirror -R --delete . www/"