mirror of
https://github.com/sipeed/sipeed_wiki.git
synced 2026-11-09 17:44:31 -06:00
update ci
This commit is contained in:
53
.github/workflows/publish.yml
vendored
53
.github/workflows/publish.yml
vendored
@@ -1,8 +1,8 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: CI
|
||||
name: build_doc_upload
|
||||
|
||||
# Controls when the action will run.
|
||||
# Controls when the action will run.
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the main branch
|
||||
push:
|
||||
@@ -35,25 +35,42 @@ jobs:
|
||||
pip3 install teedoc
|
||||
ls -al ~/.local/bin/
|
||||
export PATH=~/.local/bin/:$PATH
|
||||
echo "== install plugins =="
|
||||
teedoc install
|
||||
echo "== start build =="
|
||||
teedoc build
|
||||
echo "== build complete =="
|
||||
out_dir=out`python3 -c 'import json; f=open("site_config.json");config=json.load(f);print(config["site_root_url"])'`
|
||||
sync_gitee=`pwd`/.github/workflows/sync_gitee.yml
|
||||
cd $out_dir
|
||||
mv $out_dir ../
|
||||
remote_addr=`git remote get-url --push origin`
|
||||
remote_addr=`echo $remote_addr| awk -F'://' '{print $2}'`
|
||||
user_name=`git log -1 --pretty=format:'%an'`
|
||||
user_email=`git log -1 --pretty=format:'%ae'`
|
||||
echo "== checkout gh-pages branch =="
|
||||
git fetch origin gh-pages
|
||||
git checkout gh-pages
|
||||
git pull origin gh-pages
|
||||
echo "== upload to cloud server =="
|
||||
pip3 install qiniu
|
||||
teedoc-upload --cloud qiniu --bucket ${{ secrets.QINIU_BUCKET }} --access_key ${{ secrets.QINIU_ACCESS_KEY }} --secret_key ${{ secrets.QINIU_SECRET_KEY }} --old ./ ../${out_dir}
|
||||
echo "== upload to gh-pages for pages service =="
|
||||
cd ../$out_dir
|
||||
git init
|
||||
git config user.name ${{ secrets.GIT_NAME }}
|
||||
git config user.email ${{ secrets.GIT_EMAIL }}
|
||||
git remote add upstream "git@github.com:${{ secrets.REPO }}.git"
|
||||
mkdir -p .github/workflows
|
||||
cp $sync_gitee .github/workflows/
|
||||
git config user.name ${user_name}
|
||||
git config user.email ${user_email}
|
||||
remote_addr=https://${user_name}:${{ secrets.GITHUB_TOKEN }}@${remote_addr}
|
||||
git remote add origin ${remote_addr}
|
||||
git add -A
|
||||
git commit -m "rebuild website ad $GITHUB_REF"
|
||||
SSHPATH="$HOME/.ssh"
|
||||
rm -rf "$SSHPATH"
|
||||
mkdir -p "$SSHPATH"
|
||||
echo "${{ secrets.ACCESS_KEY }}" > "$SSHPATH/id_rsa"
|
||||
chmod 600 "$SSHPATH/id_rsa"
|
||||
sudo sh -c "echo StrictHostKeyChecking no >>/etc/ssh/ssh_config"
|
||||
git push upstream HEAD:gh-pages --force
|
||||
|
||||
|
||||
git push origin HEAD:gh-pages --force
|
||||
echo "== push complete =="
|
||||
|
||||
|
||||
# SSHPATH="$HOME/.ssh"
|
||||
# rm -rf "$SSHPATH"
|
||||
# mkdir -p "$SSHPATH"
|
||||
# echo "${{ secrets.ACCESS_KEY }}" > "$SSHPATH/id_rsa"
|
||||
# chmod 600 "$SSHPATH/id_rsa"
|
||||
# sudo sh -c "echo StrictHostKeyChecking no >>/etc/ssh/ssh_config"
|
||||
# git push origin HEAD:gh-pages --force
|
||||
|
||||
|
||||
70
.github/workflows/publish_upload_all.yml
vendored
Executable file
70
.github/workflows/publish_upload_all.yml
vendored
Executable file
@@ -0,0 +1,70 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: build_doc_upload_all
|
||||
|
||||
# Controls when the action will run.
|
||||
on:
|
||||
# Only allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.8]
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Runs a set of commands using the runners shell
|
||||
- name: build doc and push to github pages
|
||||
run: |
|
||||
pip3 install setuptools
|
||||
pip3 install teedoc
|
||||
ls -al ~/.local/bin/
|
||||
export PATH=~/.local/bin/:$PATH
|
||||
echo "== install plugins =="
|
||||
teedoc install
|
||||
echo "== start build =="
|
||||
teedoc build
|
||||
echo "== build complete =="
|
||||
out_dir=out`python3 -c 'import json; f=open("site_config.json");config=json.load(f);print(config["site_root_url"])'`
|
||||
mv $out_dir ../
|
||||
remote_addr=`git remote get-url --push origin`
|
||||
remote_addr=`echo $remote_addr| awk -F'://' '{print $2}'`
|
||||
user_name=`git log -1 --pretty=format:'%an'`
|
||||
user_email=`git log -1 --pretty=format:'%ae'`
|
||||
echo "== checkout gh-pages branch =="
|
||||
git fetch origin gh-pages
|
||||
git checkout gh-pages
|
||||
git pull origin gh-pages
|
||||
echo "== upload to cloud server =="
|
||||
pip3 install qiniu
|
||||
teedoc-upload --cloud qiniu --bucket ${{ secrets.QINIU_BUCKET }} --access_key ${{ secrets.QINIU_ACCESS_KEY }} --secret_key ${{ secrets.QINIU_SECRET_KEY }} ../${out_dir}
|
||||
echo "== upload to gh-pages for pages service =="
|
||||
cd ../$out_dir
|
||||
git init
|
||||
git config user.name ${user_name}
|
||||
git config user.email ${user_email}
|
||||
remote_addr=https://${user_name}:${{ secrets.GITHUB_TOKEN }}@${remote_addr}
|
||||
git remote add origin ${remote_addr}
|
||||
git add -A
|
||||
git commit -m "rebuild website ad $GITHUB_REF"
|
||||
git push origin HEAD:gh-pages --force
|
||||
echo "== push complete =="
|
||||
|
||||
|
||||
# SSHPATH="$HOME/.ssh"
|
||||
# rm -rf "$SSHPATH"
|
||||
# mkdir -p "$SSHPATH"
|
||||
# echo "${{ secrets.ACCESS_KEY }}" > "$SSHPATH/id_rsa"
|
||||
# chmod 600 "$SSHPATH/id_rsa"
|
||||
# sudo sh -c "echo StrictHostKeyChecking no >>/etc/ssh/ssh_config"
|
||||
# git push origin HEAD:gh-pages --force
|
||||
|
||||
10
.github/workflows/sync_gitee.yml
vendored
10
.github/workflows/sync_gitee.yml
vendored
@@ -9,7 +9,13 @@ name: sync code to gitee
|
||||
# branches: [ master ]
|
||||
# pull_request:
|
||||
# branches: [ master ]
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the main branch
|
||||
push:
|
||||
branches: [ main ]
|
||||
# pull_request:
|
||||
# branches: [ main ]
|
||||
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
@@ -37,4 +43,4 @@ jobs:
|
||||
chmod 600 "$SSHPATH/id_rsa"
|
||||
sudo sh -c "echo StrictHostKeyChecking no >>/etc/ssh/ssh_config"
|
||||
git remote add upstream $GITEE_GIT_ADDR
|
||||
git push upstream --all --force
|
||||
git push upstream main:main --force
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,4 +2,5 @@ out
|
||||
__pycache__
|
||||
temp
|
||||
.vscode
|
||||
.ipynb_checkpoints
|
||||
.ipynb_checkpoints
|
||||
.qiniu_pythonsdk_hostscache.json
|
||||
|
||||
33
README.md
33
README.md
@@ -1,18 +1,37 @@
|
||||
# Sipeed wiki source code
|
||||
Sipeed wiki source code
|
||||
=====
|
||||
|
||||
Related site: [wiki.sipeed.com](https://wiki.sipeed.com)
|
||||
|
||||
If you want change document or add one, do the following choice.
|
||||
|
||||
## Fix error
|
||||
## Contributing and article sharing
|
||||
|
||||
If you find any error on wiki page, just fix it on github and **Commit changes**, thanks for correcting.
|
||||
You are welcome to contribute to the wiki, fixing error, adding content, or sharing your article are all welcome.
|
||||
|
||||
## Share article
|
||||
Fork this repo and change docs, then create a `Pull Request`.
|
||||
|
||||
More contribute doc :
|
||||
* [中文](./share_docs/zh/readme.md)
|
||||
* [English](./share_docs/en/readme.md)
|
||||
|
||||
|
||||
## Preview locally
|
||||
|
||||
```bash
|
||||
git clone https://github.com/sipeed/sipeed_wiki.git
|
||||
pip install teedoc
|
||||
cd sipeed_wiki
|
||||
teedoc install
|
||||
teedoc serve
|
||||
```
|
||||
|
||||
More build tool usage see [teedoc](http://github.com/teedoc/teedoc)
|
||||
|
||||
## For administator
|
||||
|
||||
GitHub action will automatically push changed doc to cloud server.
|
||||
But if you did some special things like force commit, some files maybe missing on server, manually trigger the publish_upload_all action to build doc and upload all files to server.
|
||||
|
||||
We are glad that people share their article on our wiki page
|
||||
|
||||
Choose one language below to start to know how to share article.
|
||||
|
||||
[中文](./share_docs/zh/readme.md) [English](./share_docs/en/readme.md)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
---
|
||||
|
||||
目前 wiki 主要网页支持 markdown 和 ipynb 两种说明文档
|
||||
目前 wiki 主要网页支持 markdown 和 ipynb 两种文档
|
||||
|
||||
我们在 https://github.com/sipeed/sipeed_wiki/tree/main/docs 页面选择 'Upload files'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user