Update GSoC contributor page #92
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: Publish Docs | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'PR number to deploy preview for' | |
| required: true | |
| type: number | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Determine Base URL | |
| id: base-url | |
| run: | | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| OWNER="${{ github.repository_owner }}" | |
| # Check if it's an org page (owner.github.io) | |
| if [[ "${REPO_NAME,,}" == "${OWNER,,}.github.io" ]]; then | |
| BASE_PATH="/" | |
| else | |
| BASE_PATH="/$REPO_NAME/" | |
| fi | |
| echo "base_path=$BASE_PATH" >> $GITHUB_OUTPUT | |
| - name: Build | |
| run: npm run build | |
| env: | |
| BASE_URL: ${{ steps.base-url.outputs.base_path }} | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site | |
| path: build/ | |
| deploy-pr-preview: | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: refs/pull/${{ inputs.pr_number }}/head | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Determine Base URL | |
| id: base-url | |
| run: | | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| OWNER="${{ github.repository_owner }}" | |
| PR_NUM="${{ inputs.pr_number }}" | |
| # Check if it's an org page (owner.github.io) | |
| if [[ "${REPO_NAME,,}" == "${OWNER,,}.github.io" ]]; then | |
| BASE_PATH="/pr-$PR_NUM/" | |
| FULL_URL="https://$OWNER.github.io/pr-$PR_NUM/" | |
| else | |
| BASE_PATH="/$REPO_NAME/pr-$PR_NUM/" | |
| FULL_URL="https://$OWNER.github.io/$REPO_NAME/pr-$PR_NUM/" | |
| fi | |
| echo "base_path=$BASE_PATH" >> $GITHUB_OUTPUT | |
| echo "full_url=$FULL_URL" >> $GITHUB_OUTPUT | |
| - name: Build | |
| run: npm run build | |
| env: | |
| BASE_URL: ${{ steps.base-url.outputs.base_path }} | |
| - name: Deploy PR Preview | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: gh-pages | |
| folder: build | |
| target-folder: pr-${{ inputs.pr_number }} | |
| clean: true | |
| git-config-name: github-actions[bot] | |
| git-config-email: github-actions[bot]@users.noreply.github.com | |
| - name: Comment Preview URL | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| recreate: true | |
| number: ${{ inputs.pr_number }} | |
| message: | | |
| 🚀 **Preview Ready!** | |
| Your docs preview for this PR is available here: | |
| **${{ steps.base-url.outputs.full_url }}** | |
| deploy-production: | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: site | |
| path: site | |
| - name: Deploy to GitHub Pages | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: gh-pages | |
| folder: site | |
| clean: true |