Skip to content

Move non-referenced assets to dedicated public folder #41

Move non-referenced assets to dedicated public folder

Move non-referenced assets to dedicated public folder #41

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
- 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: Build 11ty site
uses: TartanLlama/actions-eleventy@master
with:
install_dependencies: true
- 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 }}