diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..73e985b --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,59 @@ +name: Deploy docs for Site +run-name: ${{ gitea.actor }} is building out Gitea Actions 🚀 +on: + push: + branches: + - main +jobs: + deploy: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - name: Checkout repository code + uses: https://gitea.com/actions/checkout@v4 + with: + ref: 'main' + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + # Skip pnpm cache to reduce overhead + - name: Install pnpm + run: | + if ! command -v pnpm &> /dev/null; then + npm install -g pnpm@9 + else + echo "pnpm is already installed" + fi + + - name: Check Node.js and pnpm versions + run: | + echo "pnpm version ===>" && pnpm -v + echo "node version ===>" && node -v + + # Simplify node_modules handling without caching + - name: Install dependencies + run: | + if [ ! -d "node_modules" ] || [ "$(find package.json -newer node_modules)" ]; then + echo "Dependencies are outdated or missing, installing..." + pnpm install + else + echo "Dependencies are up-to-date, skipping installation." + fi + + - name: Build site + run: pnpm build + + - name: ssh deploy + uses: easingthemes/ssh-deploy@v5.1.0 + with: + SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }} + REMOTE_HOST: ${{ secrets.DEPLOY_HOST }} + REMOTE_USER: ${{ secrets.DEPLOY_USER }} + SOURCE: "/dist/" + TARGET: "/webroot/sites/zhaoguiyang" + EXCLUDE: "/node_modules/"