web/.forgejo/workflows/build_and_test.yml
asandikci 7727e0c5c0
All checks were successful
Build and Deploy Test Version (with Drafts) - next.asandikci.com / build-drafts-and-deploy (push) Successful in 3m9s
Update .forgejo/workflows/build_and_test.yml
2025-01-19 17:58:53 +03:00

66 lines
No EOL
1.8 KiB
YAML

name: "Build and Deploy Test Version (with Drafts) - next.asandikci.com"
on:
push:
branches:
- main
paths-ignore:
- .gitignore
- README.md
- LICENSE
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build-drafts-and-deploy:
runs-on: docker
container:
image: git.asandikci.com/docker-images/website_builder:latest
steps:
- name: Git Clone
env:
BRANCH: ${{ github.ref_name }}
run: |
git clone --no-checkout https://git.asandikci.com/asandikci.com/web .
git checkout --progress --force "$BRANCH"
- name: Build Site (with Drafts!)
run: |
bundle install
bundle exec jekyll b --drafts
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: |
mkdir deploy && cd deploy
cp -rfv ../_site .
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/"