forked from UD-CISC275-S22/tasks
-
Notifications
You must be signed in to change notification settings - Fork 256
154 lines (133 loc) · 5 KB
/
deploy.yml
File metadata and controls
154 lines (133 loc) · 5 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Workflow for publishing the students' website along with additional helpful information
name: Deploy main branch as website
on:
push:
branches: [main]
workflow_dispatch:
# Required permissions for Pages v4 + artifact v4
permissions:
actions: read # NEW: required by deploy-pages@v4
contents: read
pages: write
id-token: write
# Only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
# Recommended for Pages so the URL shows on the run summary
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- id: get-repo-values
name: Get repository values
run: |
url=https://$(echo "${{ github.repository }}" | sed "s/\//.github.io\//")
echo "url=$url" >> $GITHUB_OUTPUT
- name: Update package.json homepage
uses: jossef/action-set-json-field@v1
with:
file: package.json
field: homepage
value: ${{ steps.get-repo-values.outputs.url }}
# create_redirects
- name: Create Redirects and Links
id: create_redirects
run: |
mkdir -p dist
echo "<html><head>\
<meta http-equiv='refresh' content='0; URL=${{github.server_url}}/${{github.repository}}' />\
</head><body>Redirecting to repository</body></html>" > ./dist/repo.html
mkdir -p docs
cp README.md docs/index.md
echo "# Quick Links" > docs/quick-links.md
echo "* [Repository](../repo.html)" >> docs/quick-links.md
echo "<html><head>\
<meta http-equiv='refresh' content='0; URL=docs/quick-links' />\
</head><body>Redirecting to quick links page</body></html>" > ./dist/quick.html
# Install node packages
- name: Install
id: install
run: |
echo "<html><body><pre>" > ./dist/installation.html
npm ci |& tee -a ./dist/installation.html
echo "</pre></body></html>" >> ./dist/installation.html
echo "* [Installation](../installation.html)" >> docs/quick-links.md
# Run linter (ensure your script writes dist/lint.html)
- name: Run Linter
id: lint
run: |
npm run eslint-output
echo "* [Linter](../lint.html)" >> docs/quick-links.md
# Build the project
- name: Build the project
id: build
run: |
echo "<html><body><pre>" > ./dist/build.html
npm run build |& tee -a ./dist/build.html
mv ./build/* ./dist
echo "</pre></body></html>" >> ./dist/build.html
echo "* [Build](../build.html)" >> docs/quick-links.md
# Run Tests
- name: Run Tests
id: test
run: |
echo "<html><body><pre>" > ./dist/tests.html
npm test -- --coverage |& tee -a ./dist/tests.html
echo "</pre></body></html>" >> ./dist/tests.html
echo "* [Tests](../tests.html)" >> docs/quick-links.md
# Verify Integrity
- name: Verify Integrity
if: ${{ !cancelled() }}
id: integrity
run: |
echo "<html><body><pre>" > ./dist/integrity.html
find src -type f -name "*.test.ts" -exec md5sum {} + >> ./dist/integrity.html
find src -type f -name "*.test.tsx" -exec md5sum {} + >> ./dist/integrity.html
md5sum .eslintrc.js >> ./dist/integrity.html
md5sum jest.config.js >> ./dist/integrity.html
md5sum tsconfig.json >> ./dist/integrity.html
md5sum .github/workflows/deploy.yml >> ./dist/integrity.html
echo "</pre></body></html>" >> ./dist/integrity.html
echo "* [Integrity](../integrity.html)" >> docs/quick-links.md
# Create GitInspector Report
- name: Create GitInspector Report
if: ${{ !cancelled() }}
id: gitinspector
run: |
git clone https://github.com/jpwhite3/gitinspector.git
python ./gitinspector/gitinspector.py ./ --grading --format=html -f tsx,ts,html,css -x ./gitinspector -x ./node_modules -x ./wbcore > ./dist/git.html
echo "* [Git Inspector](../git.html)" >> docs/quick-links.md
# Generate HTML from Markdown in Docs/
- name: Generate HTML from Markdown in Docs/
if: ${{ !cancelled() }}
id: markdown-docs
uses: ldeluigi/markdown-docs@latest
with:
src: docs
dst: dist/docs/
# Pages
- name: Setup Pages
if: ${{ !cancelled() }}
uses: actions/configure-pages@v5
- name: Upload artifact (for Pages)
if: ${{ !cancelled() }}
uses: actions/upload-pages-artifact@v4
with:
path: "dist/"
- name: Deploy to GitHub Pages
if: ${{ !cancelled() }}
id: deployment
uses: actions/deploy-pages@v4