Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
rewrite#3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
rewrite #3
Changes from all commits
71eadceb2f6f3ab57c6d6d5505cf4fe4a3fcd23257a8612cd66a5568d74e53473f8734800905e662f5363c9beebfbadc99File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,72 +9,41 @@ permissions: | ||
| id-token: write | ||
| pages: write | ||
| env: | ||
| INSTANCE: 'Writerside/xd' | ||
| ARTIFACT: 'webHelpXD2-all.zip' | ||
| DOCKER_VERSION: '241.18775' | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Build docs using Writerside Docker builder | ||
| uses: JetBrains/writerside-github-action@v4 | ||
| with: | ||
| instance: ${{ env.INSTANCE }} | ||
| artifact: ${{ env.ARTIFACT }} | ||
| docker-version: ${{ env.DOCKER_VERSION }} | ||
| - name: Save artifact with build results | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: docs | ||
| path: | | ||
| artifacts/${{ env.ARTIFACT }} | ||
| artifacts/report.json | ||
| retention-days: 7 | ||
| test: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| name: docs | ||
| path: artifacts | ||
| node-version: 20 | ||
| cache: npm | ||
| - name: Test documentation | ||
| uses: JetBrains/writerside-checker-action@v1 | ||
| with: | ||
| instance: ${{ env.INSTANCE }} | ||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| needs: [build, test] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: docs | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Unzip artifact | ||
| run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d dir | ||
| - name: Build docs | ||
| run: npm run docs:build | ||
PythonSmall-Q marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v4 | ||
| - name: Package and upload Pages artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: dir | ||
| path: .vitepress/dist | ||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: PR preview cleanup | ||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| cleanup: | ||
| name: Delete FTP preview | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Install lftp | ||
| run: sudo apt-get install -y lftp | ||
PythonSmall-Q marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| - name: Remove preview directory from FTP | ||
| env: | ||
| FTP_USERNAME: ${{ secrets.FTP_USERNAME }} | ||
| FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| run: | | ||
| lftp -c " | ||
| set ftp:ssl-allow no; | ||
PythonSmall-Q marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| open -u $FTP_USERNAME,$FTP_PASSWORD ftpupload.net; | ||
| rm -rf htdocs/pr-$PR_NUMBER/; | ||
| bye | ||
| " | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| name: PR preview | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| jobs: | ||
| preview: | ||
| name: Build & deploy preview | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
| - name: Install dependencies | ||
| run: npm ci | ||
PythonSmall-Q marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| - name: Build docs | ||
| run: npm run docs:build -- --base /pr-${{ github.event.pull_request.number }}/ | ||
| - name: Deploy to FTP | ||
| uses: SamKirkland/FTP-Deploy-Action@v4.3.5 | ||
| with: | ||
| server: ftpupload.net | ||
| port: 21 | ||
| username: ${{ secrets.FTP_USERNAME }} | ||
| password: ${{ secrets.FTP_PASSWORD }} | ||
| local-dir: .vitepress/dist/ | ||
PythonSmall-Q marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| server-dir: htdocs/pr-${{ github.event.pull_request.number }}/ | ||
| - name: Comment on PR | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const prNumber = context.payload.pull_request.number; | ||
| const previewUrl = `http://xmoj-docs.infinityfreeapp.com/pr-${prNumber}/`; | ||
| const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | ||
| const body = [ | ||
| '## 📖 文档预览', | ||
| '', | ||
| `构建成功!点击下方链接在线预览文档(PR 关闭后自动删除)。`, | ||
| '', | ||
| `**[🔗 在线预览](${previewUrl})**`, | ||
| '', | ||
| `> 预览地址:\`${previewUrl}\``, | ||
| `> 构建运行:[#${context.runNumber}](${runUrl})`, | ||
| ].join('\n'); | ||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| }); | ||
| const botComment = comments.find( | ||
| c => c.user.type === 'Bot' && c.body.includes('## 📖 文档预览') | ||
| ); | ||
PythonSmall-Q marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (botComment) { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: botComment.id, | ||
| body, | ||
| }); | ||
| } else { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body, | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Test build | ||
| on: | ||
| push: | ||
| branches-ignore: | ||
| - master | ||
| pull_request: | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| build: | ||
| name: Build docs | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
| - name: Install dependencies | ||
| run: npm ci | ||
PythonSmall-Q marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| - name: Build docs | ||
| run: npm run docs:build | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| node_modules | ||
| .vitepress/dist | ||
| .vitepress/cache |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.