Merge pull request #3 from k2-fsa/revert-2-fix_ci #3
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 | |
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 | |
- name: Build pages for kingway.fun/k2 | |
if: github.repository_owner == 'pkufool' | |
shell: bash | |
run: | | |
sed -i 's/link: \//link: \/k2\//g' mkdocs.yml | |
sed -i 's/link: \//link: \/k2\//g' mkdocs-zh-CN.yml | |
mkdocs build -f mkdocs.yml | |
mkdocs build -f mkdocs-zh-CN.yml | |
- name: Deploy pages to kingway.fun/k2 | |
if: github.repository_owner == 'pkufool' | |
run: | | |
user=${{ secrets.USERNAME }} | |
server=${{ secrets.HOST }} | |
port=${{ secrets.PORT }} | |
echo "${{ secrets.KEY }}" > id_rsa && chmod 600 id_rsa | |
scp -P $port -r -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i id_rsa site/* $user@$server:~/deploy/k2 | |
rm id_rsa |