-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (57 loc) · 1.7 KB
/
Copy pathdocs-deploy.yml
File metadata and controls
61 lines (57 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Deploy docs-site
on:
workflow_run:
workflows:
- "Deploy development docs"
- "Deploy release docs"
- "Repair release docs"
types: [completed]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: docs-site-deploy-${{ github.repository }}
cancel-in-progress: false
jobs:
upload:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
outputs:
has_site: ${{ steps.site-check.outputs.has_site }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 1
path: workflow
- name: Check for a published docs-site branch
id: site-check
working-directory: workflow
run: |
if git ls-remote --exit-code origin refs/heads/docs-site >/dev/null 2>&1; then
echo "has_site=true" >> "$GITHUB_OUTPUT"
else
status=$?
if [ "$status" -eq 2 ]; then echo "has_site=false" >> "$GITHUB_OUTPUT"; else exit 1; fi
fi
- uses: actions/checkout@v4
if: steps.site-check.outputs.has_site == 'true'
with:
ref: docs-site
fetch-depth: 1
path: docs-site
- uses: actions/upload-pages-artifact@v3
if: steps.site-check.outputs.has_site == 'true'
with:
path: docs-site
deploy:
if: github.event.workflow_run.conclusion == 'success' && needs.upload.outputs.has_site == 'true'
needs: upload
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4