|
15 | 15 | # specific language governing permissions and limitations |
16 | 16 | # under the License. |
17 | 17 |
|
18 | | -name: Generate Docs |
| 18 | +name: Docs CI |
19 | 19 | on: |
20 | 20 | push: |
21 | | - branches: |
22 | | - - main |
23 | | - workflow_dispatch: |
24 | | - |
25 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
26 | | -permissions: |
27 | | - contents: read |
28 | | - pages: write |
29 | | - id-token: write |
| 21 | + pull_request: |
30 | 22 |
|
31 | | -# Allow only one concurrent deployment |
32 | | -concurrency: |
33 | | - group: "pages" |
34 | | - cancel-in-progress: true |
| 23 | + workflow_dispatch: |
35 | 24 |
|
36 | 25 | env: |
37 | 26 | RUST_TOOLCHAIN_VERSION: stable |
38 | 27 |
|
39 | 28 | jobs: |
40 | | - deploy: |
| 29 | + build: |
| 30 | + name: Build Docs |
| 31 | + permissions: |
| 32 | + contents: read |
41 | 33 | runs-on: ubuntu-latest |
42 | | - environment: |
43 | | - name: github-pages |
44 | | - url: ${{ steps.deployment.outputs.page_url }} |
45 | | - |
46 | 34 | steps: |
47 | 35 | - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
48 | 36 | with: |
|
85 | 73 | - name: Upload artifact |
86 | 74 | uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 |
87 | 75 | with: |
| 76 | + name: docs-${{ github.sha }} |
88 | 77 | path: 'doc' |
89 | 78 |
|
90 | | - - name: Deploy to GitHub Pages |
91 | | - id: deployment |
| 79 | + deploy_fork: |
| 80 | + name: Deploy to GitHub Pages on fork |
| 81 | + if: >- |
| 82 | + (github.event_name == 'push' || |
| 83 | + github.event_name == 'workflow_dispatch') && |
| 84 | + github.repository != 'apache/arrow-erlang' |
| 85 | + needs: build |
| 86 | + |
| 87 | + # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 88 | + permissions: |
| 89 | + contents: read |
| 90 | + pages: write |
| 91 | + id-token: write |
| 92 | + |
| 93 | + environment: |
| 94 | + name: github-pages |
| 95 | + url: ${{ steps.deployment.outputs.page_url }} |
| 96 | + |
| 97 | + # Allow only one concurrent deployment |
| 98 | + concurrency: |
| 99 | + group: "pages" |
| 100 | + cancel-in-progress: true |
| 101 | + |
| 102 | + runs-on: ubuntu-latest |
| 103 | + steps: |
| 104 | + - id: deployment |
92 | 105 | uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |
| 106 | + with: |
| 107 | + artifact_name: docs-${{ github.sha }} |
| 108 | + |
| 109 | + |
| 110 | + asf_site: |
| 111 | + # Only deploy on a push to main |
| 112 | + if: github.ref_name == 'main' && github.event_name == 'push' && github.repository == 'apache/arrow-erlang' |
| 113 | + name: Deploy to arrow.apache.org |
| 114 | + needs: build |
| 115 | + |
| 116 | + permissions: |
| 117 | + contents: write |
| 118 | + |
| 119 | + # Allow only one concurrent deployment |
| 120 | + concurrency: |
| 121 | + group: "asf_site" |
| 122 | + cancel-in-progress: true |
| 123 | + |
| 124 | + runs-on: ubuntu-latest |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 127 | + with: |
| 128 | + persist-credentials: false |
| 129 | + |
| 130 | + - name: Download artifact |
| 131 | + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 132 | + with: |
| 133 | + name: docs-${{ github.sha }} |
| 134 | + path: docs |
| 135 | + - name: Prepare website |
| 136 | + run: | |
| 137 | + mkdir -p asf-site/main |
| 138 | + tar -xf docs/artifact.tar -C asf-site/main |
| 139 | + cp .asf.yaml asf-site |
| 140 | + cp .htaccess asf-site |
| 141 | + - name: Deploy to ASF |
| 142 | + uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 |
| 143 | + with: |
| 144 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 145 | + publish_dir: asf-site |
| 146 | + publish_branch: asf-site |
| 147 | + # Avoid accumulating history of in progress API jobs: https://github.com/apache/arrow-rs/issues/5908 |
| 148 | + force_orphan: true |
0 commit comments