kou commented on code in PR #68:
URL: https://github.com/apache/arrow-erlang/pull/68#discussion_r3494520411


##########
.github/workflows/docs.yml:
##########
@@ -83,8 +70,70 @@ jobs:
       - name: Upload artifact
         uses: actions/upload-pages-artifact@v5
         with:
+          name: docs-${{ github.sha }}
           path: 'doc'
 
-      - name: Deploy to GitHub Pages
-        id: deployment
+  gh_pages:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'

Review Comment:
   Could you also add `&& github.repository != 'apache/arrow-erlang'` to use 
this only on fork?
   
   How about removing `github.ref_name == 'main`?
   
   If we remove it, we can use GitHub Pages on fork as a preview of PR.
   
   For example: apache/arrow-site does it:
   * A sample PR: https://github.com/apache/arrow-site/pull/729
   * Deploy to GitHub Pages: 
https://github.com/apache/arrow-site/blob/b097c84971be3f31724eb7c70df475b1104beca1/.github/workflows/deploy.yml#L138-L154
   * PR comment workflow: 
https://github.com/apache/arrow-site/blob/main/.github/workflows/pr_comment.yml



##########
.github/workflows/docs.yml:
##########
@@ -15,37 +15,24 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: Generate Docs
+name: Docs CI
 on:
   push:
     branches:
       - main

Review Comment:
   Could you remove this to test this workflow on fork without creating a PR?
   
   
   ```suggestion
   ```



##########
.github/workflows/docs.yml:
##########
@@ -83,8 +70,70 @@ jobs:
       - name: Upload artifact
         uses: actions/upload-pages-artifact@v5
         with:
+          name: docs-${{ github.sha }}
           path: 'doc'
 
-      - name: Deploy to GitHub Pages
-        id: deployment
+  gh_pages:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'
+    name: Deploy to GitHub Pages
+    needs: build
+
+    # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+    permissions:
+      contents: read
+      pages: write
+      id-token: write
+
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "pages"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - id: deployment
         uses: actions/deploy-pages@v5
+        with:
+           artifact_name: docs-${{ github.sha }}
+
+
+  asf_site:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'

Review Comment:
   Could you also add `&& github.repository == 'apache/arrow-erlang'` to run 
this on only `apache/arrow-erlang`?



##########
.github/workflows/docs.yml:
##########
@@ -83,8 +70,70 @@ jobs:
       - name: Upload artifact
         uses: actions/upload-pages-artifact@v5
         with:
+          name: docs-${{ github.sha }}
           path: 'doc'
 
-      - name: Deploy to GitHub Pages
-        id: deployment
+  gh_pages:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'
+    name: Deploy to GitHub Pages
+    needs: build
+
+    # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+    permissions:
+      contents: read
+      pages: write
+      id-token: write
+
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "pages"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - id: deployment
         uses: actions/deploy-pages@v5
+        with:
+           artifact_name: docs-${{ github.sha }}

Review Comment:
   Have you tested this on your fork?
   
   
https://github.com/apache/arrow-erlang/actions/runs/28364162213?pr=68#artifacts 
is `artifact.tar`. It seems that we need to extract it manually.



##########
.github/workflows/docs.yml:
##########
@@ -83,8 +70,70 @@ jobs:
       - name: Upload artifact
         uses: actions/upload-pages-artifact@v5
         with:
+          name: docs-${{ github.sha }}
           path: 'doc'
 
-      - name: Deploy to GitHub Pages
-        id: deployment
+  gh_pages:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'
+    name: Deploy to GitHub Pages
+    needs: build
+
+    # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+    permissions:
+      contents: read
+      pages: write
+      id-token: write
+
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "pages"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - id: deployment
         uses: actions/deploy-pages@v5
+        with:
+           artifact_name: docs-${{ github.sha }}
+
+
+  asf_site:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'
+    name: Deploy to arrow.apache.org
+    needs: build
+
+    permissions:
+      contents: write
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "asf_site"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v7
+      - name: Download artifact
+        uses: actions/download-artifact@v8
+        with:
+          name: docs-${{ github.sha }}
+          path: docs
+      - name: Prepare website
+        run: |
+          tar -xf docs/artifact.tar -C docs
+          rm docs/artifact.tar

Review Comment:
   How about using other directory (`asf-site`?) instead of reusing `docs/` 
directory for clean directory?
   
   
   ```suggestion
             tar -xf docs/artifact.tar -C asf-site
   ```



##########
.github/workflows/docs.yml:
##########
@@ -15,37 +15,24 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: Generate Docs
+name: Docs CI
 on:
   push:
     branches:
       - main
-  workflow_dispatch:
-
-# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
-permissions:
-  contents: read
-  pages: write
-  id-token: write
+  pull_request:
 
-# Allow only one concurrent deployment
-concurrency:
-  group: "pages"
-  cancel-in-progress: true
+  workflow_dispatch:
 
 env:
   RUST_TOOLCHAIN_VERSION: stable
 
 jobs:
-  deploy:
+  build:

Review Comment:
   Can we add `permissions: contents: read` to this job?



##########
.github/workflows/docs.yml:
##########
@@ -83,8 +70,70 @@ jobs:
       - name: Upload artifact
         uses: actions/upload-pages-artifact@v5
         with:
+          name: docs-${{ github.sha }}
           path: 'doc'
 
-      - name: Deploy to GitHub Pages
-        id: deployment
+  gh_pages:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'
+    name: Deploy to GitHub Pages
+    needs: build
+
+    # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+    permissions:
+      contents: read
+      pages: write
+      id-token: write
+
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "pages"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - id: deployment
         uses: actions/deploy-pages@v5
+        with:
+           artifact_name: docs-${{ github.sha }}
+
+
+  asf_site:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'
+    name: Deploy to arrow.apache.org
+    needs: build
+
+    permissions:
+      contents: write
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "asf_site"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v7
+      - name: Download artifact
+        uses: actions/download-artifact@v8
+        with:
+          name: docs-${{ github.sha }}
+          path: docs
+      - name: Prepare website
+        run: |
+          tar -xf docs/artifact.tar -C docs
+          rm docs/artifact.tar
+          cp .asf.yaml ./docs/.asf.yaml

Review Comment:
   Can we add `.asf.yaml` to `artifact.tar` in the `build` job instead of 
adding `.asf.yaml` here?
   
   If we use the artifact as-is, it'll be easier to debug content a bit.



##########
.github/workflows/docs.yml:
##########
@@ -83,8 +70,70 @@ jobs:
       - name: Upload artifact
         uses: actions/upload-pages-artifact@v5
         with:
+          name: docs-${{ github.sha }}
           path: 'doc'
 
-      - name: Deploy to GitHub Pages
-        id: deployment
+  gh_pages:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'
+    name: Deploy to GitHub Pages
+    needs: build
+
+    # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+    permissions:
+      contents: read
+      pages: write
+      id-token: write
+
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "pages"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - id: deployment
         uses: actions/deploy-pages@v5
+        with:
+           artifact_name: docs-${{ github.sha }}
+
+
+  asf_site:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push'

Review Comment:
   Should we publish `main` docs to https://arrow.apache.org/erlang/ ?
   
   I think that we should publish released version's docs to 
https://arrow.apache.org/erlang/ .
   
   If we want to publish non released version's docs, we can use sub path. For 
example, https://github.com/apache/arrow-adbc uses 
https://arrow.apache.org/adbc/main/ . The latest released version's docs are 
https://arrow.apache.org/adbc/current/ .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to