|
11 | 11 |
|
12 | 12 | permissions: |
13 | 13 | actions: read |
| 14 | + contents: write |
14 | 15 | issues: write |
15 | 16 | pull-requests: write |
16 | 17 |
|
17 | 18 | jobs: |
18 | 19 | comment: |
19 | 20 | if: github.event.workflow_run.event == 'pull_request' |
20 | | - name: Comment documentation preview URL |
| 21 | + name: Deploy documentation preview |
21 | 22 | runs-on: ubuntu-latest |
| 23 | + concurrency: |
| 24 | + group: docs-preview-gh-pages |
| 25 | + cancel-in-progress: false |
22 | 26 | steps: |
23 | 27 | - name: Find pull request |
24 | 28 | id: pr |
|
38 | 42 | pull_number: pr.number, |
39 | 43 | }); |
40 | 44 |
|
| 45 | + if (data.state !== 'open') { |
| 46 | + core.info('Pull request is not open.'); |
| 47 | + return; |
| 48 | + } |
| 49 | +
|
| 50 | + if (data.head.repo.full_name !== `${context.repo.owner}/${context.repo.repo}`) { |
| 51 | + core.info('Pull request is not from this repository.'); |
| 52 | + return; |
| 53 | + } |
| 54 | +
|
41 | 55 | if (!data.labels.some(label => label.name === 'documentation')) { |
42 | 56 | core.info('Pull request does not have the documentation label.'); |
43 | 57 | return; |
|
63 | 77 |
|
64 | 78 | core.setOutput('number', pr.number); |
65 | 79 |
|
| 80 | + - uses: actions/checkout@v6 |
| 81 | + if: steps.pr.outputs.number != '' |
| 82 | + with: |
| 83 | + ref: refs/pull/${{ steps.pr.outputs.number }}/merge |
| 84 | + fetch-depth: 0 |
| 85 | + |
| 86 | + - uses: julia-actions/setup-julia@v2 |
| 87 | + if: steps.pr.outputs.number != '' |
| 88 | + with: |
| 89 | + version: '1' |
| 90 | + |
| 91 | + - name: "Documentation dev environment setup" |
| 92 | + if: steps.pr.outputs.number != '' |
| 93 | + run: | |
| 94 | + julia --project=docs -e ' |
| 95 | + using Pkg |
| 96 | + Pkg.develop([ |
| 97 | + PackageSpec(path=pwd(), subdir="."), |
| 98 | + PackageSpec(path=pwd(), subdir="KomaMRIBase"), |
| 99 | + PackageSpec(path=pwd(), subdir="KomaMRICore"), |
| 100 | + PackageSpec(path=pwd(), subdir="KomaMRIFiles"), |
| 101 | + PackageSpec(path=pwd(), subdir="KomaMRIPlots") |
| 102 | + ]) |
| 103 | + Pkg.instantiate()' |
| 104 | +
|
| 105 | + - name: Build and deploy preview |
| 106 | + if: steps.pr.outputs.number != '' |
| 107 | + run: | |
| 108 | + GITHUB_EVENT_NAME=pull_request \ |
| 109 | + GITHUB_REF=refs/pull/${{ steps.pr.outputs.number }}/merge \ |
| 110 | + julia --project=docs docs/make.jl push_preview |
| 111 | + env: |
| 112 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 113 | + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} |
| 114 | + |
66 | 115 | - name: Comment preview URL |
67 | 116 | if: steps.pr.outputs.number != '' |
68 | 117 | uses: actions/github-script@v7 |
|
0 commit comments