Skip to content

Switch Eleventy runner #50

Switch Eleventy runner

Switch Eleventy runner #50

Workflow file for this run

name: Deploy and build static site
on:
push:
branches: [master]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Set datetime env var
run: echo "DATETIME=$(date -u +"%Y%m%d-%H%M%SZ")" >> $GITHUB_ENV
- name: Set deploy folder env var
run: echo "TMP_FOLDER=/tmp/${{github.event.repository.name}}-${{env.DATETIME}}" >> $GITHUB_ENV
- name: Echo Node version
run: node -v
- name: Build Eleventy site
uses: extrawitz/11ty-dockerless-build@v1
- name: Transfer built site to server
uses: appleboy/scp-action@master
with:
source: "dist"
target: "${{env.TMP_FOLDER}}"
strip_components: 1
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
- name: Move built site to Nginx folder
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
find ${{ secrets.DEPLOY_FOLDER }} -mindepth 1 -delete
mv ${{env.TMP_FOLDER}}/* ${{ secrets.DEPLOY_FOLDER }}