Skip to content

Commit 40ec846

Browse files
Merge pull request #57 from grugnog/github-actions
Adding Github Action to build artifacts using LiaScript Exporter
2 parents fec9eb6 + 6bedca1 commit 40ec846

18 files changed

Lines changed: 36232 additions & 4 deletions

.github/workflows/test-action.yml

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
name: Test All Action Capabilities
2+
on: [push]
3+
4+
jobs:
5+
test-action:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- name: Checkout LiaScript docs
12+
uses: actions/checkout@v4
13+
with:
14+
repository: LiaScript/docs
15+
path: docs
16+
17+
# Test SCORM 1.2 with all settings
18+
- name: Export to SCORM 1.2 (Full Settings)
19+
id: export-scorm12
20+
uses: ./
21+
with:
22+
input-file: 'docs/README.md'
23+
format: 'scorm1.2'
24+
output-name: 'test-scorm12-full'
25+
scorm-organization: 'Test Organization'
26+
scorm-mastery-score: '85'
27+
scorm-typical-duration: 'PT1H30M0S'
28+
scorm-iframe: true
29+
scorm-embed: true
30+
scorm-always-active: true
31+
32+
# Test SCORM 2004
33+
- name: Export to SCORM 2004
34+
id: export-scorm2004
35+
uses: ./
36+
with:
37+
input-file: 'docs/README.md'
38+
format: 'scorm2004'
39+
output-name: 'test-scorm2004'
40+
scorm-organization: 'Test Organization'
41+
scorm-mastery-score: '75'
42+
43+
# Test PDF with custom settings
44+
- name: Export to PDF (Custom Settings)
45+
id: export-pdf
46+
uses: ./
47+
with:
48+
input-file: 'docs/README.md'
49+
format: 'pdf'
50+
output-name: 'test-pdf-custom'
51+
pdf-theme: 'blue'
52+
pdf-format: 'A4'
53+
pdf-scale: '1.2'
54+
pdf-landscape: true
55+
pdf-print-background: true
56+
57+
# Test Web export with all settings
58+
- name: Export to Web
59+
id: export-web
60+
uses: ./
61+
with:
62+
input-file: 'docs/README.md'
63+
format: 'web'
64+
output-name: 'test-web'
65+
web-zip: true
66+
web-indexeddb: true
67+
web-iframe: true
68+
69+
# Test IMS package
70+
- name: Export to IMS
71+
id: export-ims
72+
uses: ./
73+
with:
74+
input-file: 'docs/README.md'
75+
format: 'ims'
76+
output-name: 'test-ims'
77+
ims-indexeddb: true
78+
79+
# Test xAPI package
80+
- name: Export to xAPI
81+
id: export-xapi
82+
uses: ./
83+
with:
84+
input-file: 'docs/README.md'
85+
format: 'xapi'
86+
output-name: 'test-xapi'
87+
xapi-course-id: 'test-course-123'
88+
xapi-course-title: 'Test Course Title'
89+
xapi-debug: true
90+
xapi-zip: true
91+
92+
# Test RDF export
93+
- name: Export to RDF (JSON-LD)
94+
id: export-rdf-jsonld
95+
uses: ./
96+
with:
97+
input-file: 'docs/README.md'
98+
format: 'rdf'
99+
output-name: 'test-rdf-jsonld'
100+
rdf-format: 'json-ld'
101+
rdf-type: 'Course'
102+
rdf-educational-level: 'intermediate'
103+
104+
# Test RDF export (N-Quads)
105+
- name: Export to RDF (N-Quads)
106+
id: export-rdf-nquads
107+
uses: ./
108+
with:
109+
input-file: 'docs/README.md'
110+
format: 'rdf'
111+
output-name: 'test-rdf-nquads'
112+
rdf-format: 'n-quads'
113+
rdf-type: 'EducationalResource'
114+
115+
# Test JSON export
116+
- name: Export to JSON
117+
id: export-json
118+
uses: ./
119+
with:
120+
input-file: 'docs/README.md'
121+
format: 'json'
122+
output-name: 'test-json'
123+
124+
# Test with custom styling
125+
- name: Export with Custom Styling
126+
id: export-styled
127+
uses: ./
128+
with:
129+
input-file: 'docs/README.md'
130+
format: 'scorm1.2'
131+
output-name: 'test-styled'
132+
style: 'body { background-color: #f0f0f0; } .lia-slide { border: 2px solid #333; }'
133+
scorm-organization: 'Styled Test'
134+
135+
# Test with course path override
136+
- name: Export with Course Path Override
137+
id: export-course-path
138+
uses: ./
139+
with:
140+
input-file: 'docs/README.md'
141+
course-path: 'docs'
142+
format: 'scorm1.2'
143+
output-name: 'test-course-path'
144+
scorm-organization: 'Course Path Test'
145+
146+
# Upload all artifacts
147+
- name: Upload SCORM 1.2 Full
148+
uses: actions/upload-artifact@v4
149+
with:
150+
name: test-scorm12-full
151+
path: ${{ steps.export-scorm12.outputs.output-file }}
152+
153+
- name: Upload SCORM 2004
154+
uses: actions/upload-artifact@v4
155+
with:
156+
name: test-scorm2004
157+
path: ${{ steps.export-scorm2004.outputs.output-file }}
158+
159+
- name: Upload PDF Custom
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: test-pdf-custom
163+
path: ${{ steps.export-pdf.outputs.output-file }}
164+
165+
- name: Upload Web Export
166+
uses: actions/upload-artifact@v4
167+
with:
168+
name: test-web
169+
path: ${{ steps.export-web.outputs.output-file }}
170+
171+
- name: Upload IMS Package
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: test-ims
175+
path: ${{ steps.export-ims.outputs.output-file }}
176+
177+
- name: Upload xAPI Package
178+
uses: actions/upload-artifact@v4
179+
with:
180+
name: test-xapi
181+
path: ${{ steps.export-xapi.outputs.output-file }}
182+
183+
- name: Upload RDF JSON-LD
184+
uses: actions/upload-artifact@v4
185+
with:
186+
name: test-rdf-jsonld
187+
path: ${{ steps.export-rdf-jsonld.outputs.output-file }}
188+
189+
- name: Upload RDF N-Quads
190+
uses: actions/upload-artifact@v4
191+
with:
192+
name: test-rdf-nquads
193+
path: ${{ steps.export-rdf-nquads.outputs.output-file }}
194+
195+
- name: Upload JSON Export
196+
uses: actions/upload-artifact@v4
197+
with:
198+
name: test-json
199+
path: ${{ steps.export-json.outputs.output-file }}
200+
201+
- name: Upload Styled Export
202+
uses: actions/upload-artifact@v4
203+
with:
204+
name: test-styled
205+
path: ${{ steps.export-styled.outputs.output-file }}
206+
207+
- name: Upload Course Path Test
208+
uses: actions/upload-artifact@v4
209+
with:
210+
name: test-course-path
211+
path: ${{ steps.export-course-path.outputs.output-file }}
212+
213+
# Summary step to display all results
214+
- name: Export Summary
215+
run: |
216+
echo "## Export Results Summary" >> $GITHUB_STEP_SUMMARY
217+
echo "| Format | Output File | File Size | Status |" >> $GITHUB_STEP_SUMMARY
218+
echo "|--------|-------------|-----------|---------|" >> $GITHUB_STEP_SUMMARY
219+
echo "| SCORM 1.2 Full | ${{ steps.export-scorm12.outputs.output-file }} | ${{ steps.export-scorm12.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
220+
echo "| SCORM 2004 | ${{ steps.export-scorm2004.outputs.output-file }} | ${{ steps.export-scorm2004.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
221+
echo "| PDF Custom | ${{ steps.export-pdf.outputs.output-file }} | ${{ steps.export-pdf.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
222+
echo "| Web Export | ${{ steps.export-web.outputs.output-file }} | ${{ steps.export-web.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
223+
echo "| IMS Package | ${{ steps.export-ims.outputs.output-file }} | ${{ steps.export-ims.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
224+
echo "| xAPI Package | ${{ steps.export-xapi.outputs.output-file }} | ${{ steps.export-xapi.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
225+
echo "| RDF JSON-LD | ${{ steps.export-rdf-jsonld.outputs.output-file }} | ${{ steps.export-rdf-jsonld.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
226+
echo "| RDF N-Quads | ${{ steps.export-rdf-nquads.outputs.output-file }} | ${{ steps.export-rdf-nquads.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
227+
echo "| JSON Export | ${{ steps.export-json.outputs.output-file }} | ${{ steps.export-json.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
228+
echo "| Styled Export | ${{ steps.export-styled.outputs.output-file }} | ${{ steps.export-styled.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
229+
echo "| Course Path Test | ${{ steps.export-course-path.outputs.output-file }} | ${{ steps.export-course-path.outputs.file-size }} bytes | ✅ |" >> $GITHUB_STEP_SUMMARY
230+
echo "" >> $GITHUB_STEP_SUMMARY
231+
echo "**Total Tests Completed: 11**" >> $GITHUB_STEP_SUMMARY

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ sudo npm install -g --verbose https://github.com/liaScript/LiaScript-Exporter
4848

4949
On Windows you might need to run the terminal with administrator-privileges.
5050

51-
## Basic usage
51+
## Basic CLI usage
5252

5353
If you have installed the package, you can now use `liaex` or
5454
`liascript-exporter`. If you type one of the following commands, you will get
@@ -204,7 +204,7 @@ overview page, based on a provided yaml description.
204204
Learn more: https://www.npmjs.com/package/@liascript/exporter#project
205205

206206
Example:
207-
- Input: https://github.com/LiaBooks/liabooks.github.com/blob/main/project.yaml
207+
- Input: https://github.com/LiaBooks/liabooks.github.com/blob/main/project.yml
208208
- Output: https://liabooks.github.io
209209

210210
--project-no-meta Disable the generation of meta information
@@ -957,6 +957,43 @@ This will be translated to:
957957
}
958958
```
959959
960+
## GitHub Action
961+
962+
Export your LiaScript courses directly in GitHub workflows with this GitHub Action.
963+
964+
### Quick Start
965+
966+
Add to your `.github/workflows/export.yml`:
967+
968+
```yaml
969+
name: Export Course
970+
on: [push]
971+
972+
jobs:
973+
export:
974+
runs-on: ubuntu-latest
975+
steps:
976+
- uses: actions/checkout@v4
977+
978+
- name: Export to SCORM
979+
uses: ./
980+
with:
981+
input-file: 'README.md'
982+
format: 'scorm1.2'
983+
output-name: 'my-course'
984+
scorm-organization: 'My Organization'
985+
986+
- name: Upload SCORM package
987+
uses: actions/upload-artifact@v4
988+
with:
989+
name: scorm-package
990+
path: '*.zip'
991+
```
992+
993+
### Documentation
994+
995+
For complete GitHub Action documentation, inputs, outputs, and more examples, see: [`action/README.md`](action/README.md)
996+
960997
## TODOs & Contributions
961998
962999
* Further exporter
@@ -967,8 +1004,6 @@ This will be translated to:
9671004
9681005
* Integration into the Atom IDE
9691006
970-
* GitHub actions to automate building during push ...
971-
9721007
### Custom extensions
9731008
9741009
If you are interested in creating integrations for other systems by your own,

0 commit comments

Comments
 (0)