Deploy site #12
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
# Copyright 2024 Wei Kang ([email protected]) | |
# See ../../LICENSE for clarification regarding multiple authors | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Deploy site | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
# minute (0-59) | |
# hour (0-23) | |
# day of the month (1-31) | |
# month (1-12) | |
# day of the week (0-6) | |
# nightly build at 23:50 UTC time every day | |
- cron: "50 23 * * *" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install requirements | |
shell: bash | |
run: | | |
python3 -m pip install -r requirements.txt | |
- name: Prepare k2 wheels | |
shell: bash | |
run: | | |
python3 scripts/generate_k2_wheel.py | |
python3 scripts/generate_resources.py | |
- name: Build pages | |
shell: bash | |
run: | | |
mkdocs build -f mkdocs.yml | |
mkdocs build -f mkdocs-zh-CN.yml | |
- name: Deploy pages to k2-fsa.org | |
if: github.repository_owner == 'k2-fsa' | |
run: | | |
user=${{ secrets.K2_USERNAME }} | |
server=${{ secrets.K2_HOST }} | |
port=${{ secrets.K2_PORT }} | |
echo "${{ secrets.K2_KEY }}" > id_rsa && chmod 600 id_rsa | |
scp -P $port -r -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i id_rsa site/* $user@$server:~/www | |
rm id_rsa |