spring-cloud-alibaba-group / spring-cloud-alibaba-group.github.io

20 stars 35 forks source link

[Site]: After submitting the pr, we need to deploy the pr branch for preview #137

Open yuluo-yx opened 8 months ago

yuluo-yx commented 8 months ago

Current State

Description of the current state:

The PR submission has not been deployed and the review process is complicated.

Desired State

Description of the change you are proposing:

As a documentation website, we need to deploy the pr submission at the same time as pr submission to check the updates made by pr

Would you like to fix this issue?

Yes! Please assign to me!

cxhello commented 8 months ago

@yuluo-yx I currently wrote a workflow file that can be deployed after submitting a PR. But it is a fixed site address. It would be better if a temporary preview site could be generated. Do you have any better solution?

# Simple workflow for deploying static content to GitHub Pages
name: Deploy to GitHub Pages Preview

on:
  # Runs on pull requests targeting the default branch
  pull_request_target:
    branches: ["master"]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment per PR, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: 'pages-preview @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
  cancel-in-progress: false

jobs:
  # Build job
  build:
    # Limit permissions of the GITHUB_TOKEN for untrusted code
    permissions:
      contents: read
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          # For PRs make sure to checkout the PR branch
          ref: ${{ github.event.pull_request.head.ref }}
          repository: ${{ github.event.pull_request.head.repo.full_name }}
      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 18.x
      - name: Build
        run: |
          npm install && npm run build  
      - name: Setup Pages
        uses: actions/configure-pages@v4
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          # 👇 Specify build output path
          path: build

  # Deployment job
  deploy:
    environment:
      name: 'Pages Preview'
      url: ${{ steps.deployment.outputs.page_url }}
    # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
    permissions:
      contents: read
      pages: write
      id-token: write
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4
        with:
          preview: 'true'
yuluo-yx commented 8 months ago

@cxhello We'd be very happy to have you contribute to this effort. We can use netlify open-source free solution, which is used by most document repositories, to solve our current needs.

I have sent the application email and I believe I will get a reply soon.

cxhello commented 8 months ago

@yuluo-yx thank you for your reply. Are you talking about the solution provided by Netlify?

yuluo-yx commented 8 months ago

@yuluo-yx thank you for your reply. Are you talking about the solution provided by Netlify?

yep

cxhello commented 8 months ago

@yuluo-yx OK, thanks.

cxhello commented 8 months ago

@yuluo-yx Thanks for the solution you provided, I have implemented it in my personal repository. https://github.com/cxhello/docusaurus/pull/7

You can handle it with sca. I don’t have permission.

yuluo-yx commented 8 months ago

@yuluo-yx Thanks for the solution you provided, I have implemented it in my personal repository. cxhello/docusaurus#7

You can handle it with sca. I don’t have permission.

Good job, if I remember correctly he can annotate in deployed document pages.

I'll finish the netlify open-source solution once it's approved!

cxhello commented 8 months ago

@yuluo-yx I'll keep looking at the documentation for it, I'm not familiar with it yet.

yuluo-yx commented 8 months ago

@yuluo-yx I'll keep looking at the documentation for it, I'm not familiar with it yet.

lgtm.

yuluo-yx commented 7 months ago

The next job is done by @chickenlj . track by this issue.