From 64fe5fd02d8013c4f9104de1039897889e572ecc Mon Sep 17 00:00:00 2001 From: cxykevin Date: Sat, 31 Aug 2024 18:53:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90CI/CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100755 index 0000000..64e776c --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,71 @@ +name: Build and Publish +run-name: Build and Publish book (${{ gitea.actor }}) +on: [push] + +jobs: + Run: + runs-on: ubuntu-latest + steps: + - name: Info + run: echo "OS=${{ runner.os }} NAME=${{ gitea.event_name }} REPO=${{ gitea.repository }} BRANCH=${{ gitea.ref }} ST=${{ job.status }} RUNID=${{ gitea.run_id }}" + - name: Prepare Source + run: | + echo "--- write source ---" + echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free">/etc/apt/sources.list + echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free">>/etc/apt/sources.list + echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free">>/etc/apt/sources.list + cat /etc/apt/sources.list + rm -rf /etc/apt/sources.list.d/* + echo "--- update source ---" + apt-get update + - name: Prepare Lftp + run: | + apt-get install lftp -y + - name: Checkout + uses: https://git.hmtsai.cn/actions/checkout@v4 + - name: Download submodule + run: git submodule update --init --recursive + - name: Cache mdbook + uses: https://git.hmtsai.cn/actions/cache@v4 + id: cache-mdbook + env: + cache-name: cache-mdbook + with: + key: ${{ runner.os }}-mdbook + path: | + study-area-action-deps + - name: Get file + if: ${{ steps.cache-mdbook.outputs.cache-hit != 'true' }} + run: | + git clone https://git.hmtsai.cn/cxykevin/study-area-action-deps + echo "Check..." + ls study-area-action-deps + - name: Add permission + run: chmod +x study-area-action-deps/mdbook-linux-$(uname -m) + - name: Build mdbook + run: study-area-action-deps/mdbook-linux-$(uname -m) build + - name: Cache mapbook + uses: https://git.hmtsai.cn/actions/cache@v4 + id: cache-mapbook + env: + cache-name: cache-mapbook + with: + key: mapbook + path: | + mapbook + - name: Get mapbook + if: ${{ steps.cache-mapbook.outputs.cache-hit != 'true' }} + run: | + git clone https://git.hmtsai.cn/cxykevin/mapbook + echo "Check..." + ls mapbook + - name: Build sitemap + run: | + python3 mapbook/build.py "https://learn.study-area.org.cn/linux-basic" + - name: Check book + run: ls book + - name: Upload + run: | + mv book linux-basic + lftp ${{ secrets.FTP_SITE }} -u ${{ secrets.FTP_USERNAME }},${{ secrets.FTP_PWD }} -e "mirror -R linux-basic index/linux-basic" +