Skip to content
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

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

Open
yuluo-yx opened this issue Mar 6, 2024 · 10 comments
Assignees
Labels

Comments

@yuluo-yx
Copy link
Member

yuluo-yx commented Mar 6, 2024

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!

@yuluo-yx yuluo-yx self-assigned this Mar 6, 2024
@yuluo-yx yuluo-yx added the enhancement New feature or request label Mar 6, 2024
@cxhello
Copy link
Contributor

cxhello commented Mar 8, 2024

@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
Copy link
Member Author

yuluo-yx commented Mar 8, 2024

@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
Copy link
Contributor

cxhello commented Mar 8, 2024

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

@yuluo-yx
Copy link
Member Author

yuluo-yx commented Mar 8, 2024

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

yep

@cxhello
Copy link
Contributor

cxhello commented Mar 8, 2024

@yuluo-yx OK, thanks.

@cxhello
Copy link
Contributor

cxhello commented Mar 8, 2024

@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.

@yuluo-yx
Copy link
Member Author

yuluo-yx commented Mar 8, 2024

@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
Copy link
Contributor

cxhello commented Mar 8, 2024

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

@yuluo-yx
Copy link
Member Author

yuluo-yx commented Mar 8, 2024

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

lgtm.

@yuluo-yx
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants