Skip to content

Added content for 20241112 #299

Added content for 20241112

Added content for 20241112 #299

Workflow file for this run

name: Deploy
on:
push:
branches:
- master
- main
jobs:
build:
name: Build
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache gems
id: cache-gems
uses: actions/cache@v4
with:
path: .bundle
key: ${{ runner.os }}-gems
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.docker_hub_username }}
password: ${{ secrets.docker_hub_password }}
- name: Build site
run: |
mkdir -p _site .bundle
docker run \
--rm \
--mount "type=bind,source=$PWD/.bundle,target=/usr/local/bundle" \
--mount "type=bind,source=$PWD,target=/srv/jekyll" \
--workdir /srv/jekyll \
"jekyll/jekyll:stable" \
jekyll build
- name: Package site
run: |
tar -czf site.tar.gz _site
sha256sum site.tar.gz >site.tar.gz.sha256
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: site
path: |
site.tar.gz
site.tar.gz.sha256
retention-days: 2
deploy:
name: Deploy
needs:
- build
runs-on: ubuntu-24.04
if: "!contains(github.event.head_commit.message, 'skip deploy')"
concurrency:
group: deploy
cancel-in-progress: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SFTPKEY }}
- name: Update known_hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan ${{ secrets.SFTPHOST }} >>~/.ssh/known_hosts
- uses: actions/download-artifact@v4
with:
name: site
- name: Upload artifact
run: |
test -f site.tar.gz
test -f site.tar.gz.sha256
echo -e "cd public_html/dille.name\nput site.tar.gz\nput site.tar.gz.sha256\npwd\ncd www\nput deploy.php\nput deploy.sh" > sftp
sftp -b sftp ${{ secrets.SFTPUSER }}@${{ secrets.SFTPHOST }}
- name: Trigger deployment
run: |
curl https://dille.name/deploy.php