2022-04-26 14:32:52 -04:00
|
|
|
name: 📦 Deploy Website
|
|
|
|
|
2022-04-01 15:29:18 -04:00
|
|
|
on:
|
2022-04-14 11:09:08 -04:00
|
|
|
workflow_dispatch:
|
2022-04-11 23:10:10 -04:00
|
|
|
release:
|
|
|
|
types: [published]
|
2022-04-01 15:29:18 -04:00
|
|
|
|
|
|
|
env:
|
|
|
|
PYTHON_VERSION: 3.x
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build website
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
2022-04-21 15:25:01 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: '0'
|
2022-04-29 11:21:37 -04:00
|
|
|
ref: ${{github.event.pull_request.head.ref}}
|
|
|
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
|
|
|
ssh-key: ${{ secrets.ACTIONS_SSH_KEY }}
|
|
|
|
submodules: 'true'
|
2022-04-01 15:29:18 -04:00
|
|
|
|
|
|
|
- name: Set up Python runtime
|
2022-06-09 00:13:39 -04:00
|
|
|
uses: actions/setup-python@v4
|
2022-04-01 15:29:18 -04:00
|
|
|
with:
|
2022-04-29 11:21:37 -04:00
|
|
|
python-version: '3.7'
|
2022-04-01 15:29:18 -04:00
|
|
|
|
|
|
|
- name: Cache files
|
2022-07-14 00:13:10 -04:00
|
|
|
uses: actions/cache@v3.0.5
|
2022-04-01 15:29:18 -04:00
|
|
|
with:
|
|
|
|
key: ${{ github.ref }}
|
|
|
|
path: .cache
|
|
|
|
|
|
|
|
- name: Install Python dependencies
|
|
|
|
run: |
|
2022-04-29 11:21:37 -04:00
|
|
|
pip install pipenv
|
|
|
|
pipenv install
|
2022-04-01 15:29:18 -04:00
|
|
|
|
|
|
|
- name: Build website
|
|
|
|
run: |
|
2022-04-29 11:21:37 -04:00
|
|
|
pipenv run mkdocs build
|
2022-04-01 15:29:18 -04:00
|
|
|
mv .well-known site/
|
|
|
|
tar cvf site.tar site
|
2022-04-29 11:21:37 -04:00
|
|
|
pipenv run mkdocs --version
|
2022-04-01 15:29:18 -04:00
|
|
|
|
|
|
|
- name: Package website
|
2022-04-11 00:14:26 -04:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-04-01 15:29:18 -04:00
|
|
|
with:
|
|
|
|
name: generated-site
|
|
|
|
path: site.tar
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
name: Rsync Deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: production
|
|
|
|
needs: build
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Download generated Jekyll site
|
2022-04-11 00:14:22 -04:00
|
|
|
uses: actions/download-artifact@v3
|
2022-04-01 15:29:18 -04:00
|
|
|
with:
|
|
|
|
name: generated-site
|
|
|
|
- run: tar xvf site.tar
|
|
|
|
- name: Copy built site to production
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
|
|
|
|
chmod 700 ~/.ssh/id_rsa
|
|
|
|
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
|
|
|
rsync -azP --delete site/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_PATH }}
|