forked from bittercoder/Migrator.NET
-
-
Notifications
You must be signed in to change notification settings - Fork 12
97 lines (93 loc) · 3.29 KB
/
Copy pathpages.yml
File metadata and controls
97 lines (93 loc) · 3.29 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Deploy homepage to GitHub Pages
on:
push:
branches: [master]
paths:
- "docs/**"
- ".github/workflows/pages.yml"
- ".github/scripts/render-homepage-tests.py"
- ".github/scripts/test-homepage-tests.py"
- ".github/scripts/build-docs.py"
- ".github/scripts/verify-docs.py"
workflow_run:
workflows: [".NET Pull Request"]
types: [completed]
branches: [master]
workflow_dispatch:
permissions:
contents: read
actions: read
concurrency:
group: github-pages
cancel-in-progress: false
jobs:
deploy:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
with:
ref: master
- name: Verify generated documentation and links
run: |
python3 -B .github/scripts/build-docs.py --check
python3 -B .github/scripts/verify-docs.py
- name: Verify test-count and coverage renderer
run: python3 .github/scripts/test-homepage-tests.py
- name: Select latest completed master test run
id: tests
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const { data } = await github.rest.actions.listWorkflowRuns({
...context.repo, workflow_id: 'dotnetpull.yml', branch: 'master',
event: 'push', status: 'completed', per_page: 1
});
const run = data.workflow_runs[0];
if (run) {
const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, {
...context.repo, run_id: run.id, per_page: 100
});
const coverage = artifacts.find(a => a.name === 'code-coverage' && !a.expired);
if (coverage) {
run.coverage_url = `${run.html_url}/artifacts/${coverage.id}`;
core.setOutput('has-coverage', 'true');
}
fs.writeFileSync('ci-run.json', JSON.stringify(run));
core.setOutput('run-id', String(run.id));
}
- name: Download test results from that run
if: steps.tests.outputs.run-id != ''
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ steps.tests.outputs.run-id }}
pattern: test-results-*
path: ci-results
- name: Download merged coverage from the same run
if: steps.tests.outputs.has-coverage == 'true'
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ steps.tests.outputs.run-id }}
name: code-coverage
path: ci-coverage
- name: Render test counts, coverage and provenance
if: steps.tests.outputs.run-id != ''
run: python3 .github/scripts/render-homepage-tests.py ci-results ci-run.json docs/index.html ci-coverage/Cobertura.xml
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v4
with:
path: docs
- name: Deploy homepage
id: deployment
uses: actions/deploy-pages@v4