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 blog website | |
on: | |
push: | |
branches: | |
- master | |
env: | |
SERVER_PRIVATE_KEY: ${{ secrets.SERVER_PRIVATE_KEY }} | |
SERVER_HOST: ${{ secrets.SERVER_HOST }} | |
USER_NAME: ${{ secrets.USER_NAME }} | |
# Algolia setting | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
ALGOLIA_API_ID: ${{ secrets.ALGOLIA_API_ID }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }} | |
ALGOLIA_WRITE_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }} | |
ALGOLIA_SITE_URL: http://docs.seedltd.cn | |
ALGOLIA_INDEX_NAME: seedltd-online-docs | |
steps: | |
- name: Checkout code 😀 | |
uses: actions/checkout@master | |
with: | |
ref: master | |
- name: Setup node16 👀 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
always-auth: true | |
# 装依赖 | |
- name: Install dependencies 🔧 | |
run: yarn | |
# 打包 | |
- name: Build website 🤓 | |
run: yarn docs:build | |
# 上传打包资源 | |
- name: Deploy seedltd docs 🚀 | |
uses: easingthemes/[email protected] | |
env: | |
SSH_PRIVATE_KEY: ${{ env.SERVER_PRIVATE_KEY }} | |
ARGS: '-avz --delete' | |
SOURCE: 'docs/.vitepress/dist/' | |
REMOTE_HOST: ${{ env.SERVER_HOST }} | |
REMOTE_USER: ${{ env.USER_NAME }} | |
TARGET: /home/project/client/blog | |
- name: Clear algolia index 🚨 | |
run: | | |
cd .algolia | |
pip install --upgrade 'algoliasearch>=2.0,<3.0' | |
python clear_index.py | |
- name: Scrape the site 💯 | |
run: | | |
cd .algolia | |
touch .env | |
sudo chmod +x ./scraper.sh | |
./scraper.sh |