chore: 优化 timeline 组件样式 #703
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: DEPLOYMENT | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**/github/**' | |
| - './README.md' | |
| - './.pages.yml' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Refresh Members Data | |
| run: pnpm build-member | |
| env: | |
| GITEE_USERNAME: ${{ secrets.GITEE_USERNAME }} | |
| GITEE_PASSWORD: ${{ secrets.GITEE_PASSWORD }} | |
| - name: Refresh Emoji Data | |
| run: pnpm build-emoji | |
| - name: Build Site | |
| run: pnpm build-vitepress | |
| - name: Build lunaria | |
| run: pnpm lunaria:build | |
| # 创建 GitHub Deployment 记录 | |
| - name: Create GitHub Deployment | |
| id: create_deployment | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const deploymentResponse = await github.rest.repos.createDeployment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "${{ github.ref_name }}", | |
| auto_merge: false, | |
| required_contexts: [], | |
| environment: "Production", | |
| payload: { web_url: "https://yuanshen.site/docs/" } | |
| }); | |
| const deployment = deploymentResponse.data; | |
| console.log("Deployment created:", deployment); | |
| core.setOutput('deployment_id', deployment.id); | |
| // 设置状态为 in_progress | |
| await github.rest.repos.createDeploymentStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| deployment_id: deployment.id, | |
| state: "in_progress", | |
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | |
| description: "Deployment in progress" | |
| }); | |
| # 部署 | |
| - name: Deploy | |
| id: deploy | |
| uses: easingthemes/ssh-deploy@v2.2.11 | |
| env: | |
| SSH_PRIVATE_KEY: ${{ secrets.ACCESS_TOKEN }} | |
| # 删除服务器上目录里所有文件 | |
| ARGS: '-avz --delete' | |
| # 项目 build 后静态文件位置 | |
| SOURCE: './dist/' | |
| REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
| REMOTE_PORT: ${{ secrets.REMOTE_PORT }} | |
| REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
| TARGET: ${{ secrets.TARGET }} | |
| # 部署成功:更新状态为 success | |
| - name: Update Deployment Status (Success) | |
| if: success() | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| await github.rest.repos.createDeploymentStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| deployment_id: "${{ steps.create_deployment.outputs.deployment_id }}", | |
| state: "success", | |
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | |
| description: "Deployment completed successfully", | |
| environment_url: "https://yuanshen.site/docs/" | |
| }); | |
| console.log("Deployment status updated to success"); | |
| # 部署失败:更新状态为 failure | |
| - name: Update Deployment Status (Failure) | |
| if: failure() | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| await github.rest.repos.createDeploymentStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| deployment_id: "${{ steps.create_deployment.outputs.deployment_id }}", | |
| state: "failure", | |
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | |
| description: "Deployment failed" | |
| }); | |
| console.log("Deployment status updated to failure"); |