Skip to content

misc minor fixes

misc minor fixes #81

Workflow file for this run

name: Deploy docs
on:
push:
branches:
- master
permissions:
contents: write
env:
ARTIFACT: docs.tar.gz
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: true
- name: Fetch LFS files
run: git lfs pull
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Cache dependencies
uses: actions/cache@v3
with:
key: mkdocs-material-${{ github.ref }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build the site and archive content
run: |
mkdocs build
tar -czvf $ARTIFACT site/*
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: docs
path: ${{ env.ARTIFACT }}
- name: Clean up the build
if: always()
run: rm -rf site
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download an artifact
uses: actions/download-artifact@v3
with:
name: docs
- name: List an artifact
run: ls -l
- name: Copy artifact to remote server
uses: appleboy/[email protected]
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_SSH_KEY }}
port: ${{ secrets.REMOTE_PORT }}
source: ${{ env.ARTIFACT }}
target: /home/toleg/team/datero
- name: Deploy remote server
uses: appleboy/[email protected]
env:
DIST_TAR: ${{ env.ARTIFACT }}
BASE_PATH: /home/toleg/team/datero
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_SSH_KEY }}
port: ${{ secrets.REMOTE_PORT }}
envs: DIST_TAR,BASE_PATH,SERVER_PATH,SERVER_OLD_PATH,SERVER_TMP_PATH
script: |
SERVER_PATH=${BASE_PATH}/docs
SERVER_OLD_PATH=${BASE_PATH}/docs_old
SERVER_TMP_PATH=${BASE_PATH}/docs_tmp
mkdir -p $SERVER_PATH
mkdir -p $SERVER_OLD_PATH
mkdir -p $SERVER_TMP_PATH
rsync -a --delete $SERVER_PATH/ $SERVER_OLD_PATH/
tar -xzf $BASE_PATH/$DIST_TAR --strip-components=1 -C $SERVER_TMP_PATH
rsync -a --delete $SERVER_TMP_PATH/ $SERVER_PATH/
rm -rf $SERVER_TMP_PATH
rm -f $BASE_PATH/$DIST_TAR