Slightly nicer social sharing metadata #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |