# Note: This workflow is specially optimized for building the site in Mainland China. name: Deploy on: push: branches: - main pull_request: branches: - main workflow_dispatch: jobs: build-and-deploy: runs-on: build-env # Using nikolaik/python-nodejs:python3.14-nodejs26 to avoid the setup conflict between Python and Node.js steps: - name: Checkout source code uses: https://codeberg.org/LinuxCabin/checkout@v4 with: fetch-depth: 0 - name: Install Node.js dependencies run: npm install - name: Build site run: npm run build - name: Deploy to target repository if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' env: DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} run: | cd .vitepress/dist echo "hb.linuxcabin.top" > CNAME git init git config user.name "Fangcat_Dev" git config user.email "f20091219@outlook.com" git add . git commit -m "Deploy site $(date -u '+%Y-%m-%d %H:%M:%S UTC')" git push --force "https://Fangcat_Dev:${DEPLOY_TOKEN}@codeberg.org/LinuxCabin/handbook-site.git" HEAD:pages # - name: Pre-treatment for reviewing # if: github.event_name == 'pull_request' # run: | # cd site # # 获取 PR 信息与构建时间 # PR_NUMBER="${{ github.event.pull_request.number }}" # PR_AUTHOR="${{ github.event.pull_request.user.login }}" # BUILD_TIME="$(date -u '+%Y-%m-%d %H:%M:%S UTC')" # # 在
标签后插入横幅(保留原有属性) # sed -i "s/]*\)>/