From 47606aa82218347e0201c00f95635fad4ae6eeba Mon Sep 17 00:00:00 2001 From: cxykevin Date: Mon, 8 Jul 2024 22:39:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.gitea/workflows/build.yam?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 7c97d0d..9c0398f 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -78,7 +78,7 @@ jobs: git remote set-url origin https://${{ secrets.GIT_USER }}:${{ secrets.GIT_PASSWD }}@git.hmtsai.cn/study-area-cn/study-area-cn git add . git commit -m "Auto format" - echo "__import__(\"os\").system(\"git push\")" > ezpush.py && python3 ezpush.py + echo "__import__(\"os\").system(\"sh -c \\\"git push\\\")" > ezpush.py && python3 ezpush.py Run: runs-on: ubuntu-latest steps: @@ -90,6 +90,7 @@ jobs: id: src_hash run: echo "::set-output name=npmhash::$(if [[ $(find src -type f -exec sha256sum {} \; | sha256sum | cut -d ' ' -f 1) = $(cat hash.txt) ]]; then echo run; fi)" - name: Prepare Source + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} run: | echo "--- write source ---" echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free">/etc/apt/sources.list @@ -100,9 +101,11 @@ jobs: echo "--- update source ---" apt-get update - name: Prepare Lftp + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} run: | apt-get install lftp -y - name: Cache mdbook + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} uses: https://git.hmtsai.cn/actions/cache@v4 id: cache-mdbook env: @@ -112,16 +115,19 @@ jobs: path: | study-area-action-deps - name: Get file - if: ${{ steps.cache-mdbook.outputs.cache-hit != 'true' }} + if: ${{ steps.src_hash.outputs.src_hash != 'run' && 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 + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} run: chmod +x study-area-action-deps/mdbook-linux-$(uname -m) - name: Build mdbook + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} run: study-area-action-deps/mdbook-linux-$(uname -m) build - name: Cache mapbook + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} uses: https://git.hmtsai.cn/actions/cache@v4 id: cache-mapbook env: @@ -131,17 +137,20 @@ jobs: path: | mapbook - name: Get mapbook - if: ${{ steps.cache-mapbook.outputs.cache-hit != 'true' }} + if: ${{ steps.src_hash.outputs.src_hash != 'run' && steps.cache-mapbook.outputs.cache-hit != 'true' }} run: | git clone https://git.hmtsai.cn/cxykevin/mapbook echo "Check..." ls mapbook - name: Build sitemap + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} run: | python3 mapbook/build.py - name: Check book + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} run: ls book - name: Upload + if: ${{ steps.src_hash.outputs.src_hash != 'run' }} run: | mv book index lftp ${{ secrets.FTP_SITE }} -u ${{ secrets.FTP_USERNAME }},${{ secrets.FTP_PWD }} -e "mirror -R index index"