Deploy Astro App #111
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Astro App | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_run: | |
| workflows: | |
| - Update Class Widgets 2 Releases JSON | |
| types: | |
| - completed | |
| permissions: | |
| contents: write # 允许写入仓库内容(如 git push、创建 release 等) | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' # 请根据项目需要替换 Node.js 版本 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build the application | |
| run: pnpm astro build | |
| - name: deploy | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./dist |