Skip to content

Update borland-dos-pipeline.yml #56

Update borland-dos-pipeline.yml

Update borland-dos-pipeline.yml #56

---
name: Build Wolfenstein 3D
on:
- push
- pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dosbox
run: |
sudo apt-get install snapd
sudo snap install dosbox-x
- name: Run DosBox to build Wolf3D
run: >
export TERM=dumb
dosbox-x -silent -debug -conf dosbox.conf -c "mount c . && c: && call autoexec.bat" -log-con
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-dos
path: WOLF3D
- name: Upload console log
uses: actions/upload-artifact@v3
with:
name: dosbox-console-log
path: dosbox_console_log.txt
generate-html:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build-dos
- name: List files in artifact directory
run: ls -R .
- name: Zip the build output
run: |
zip -r ./wolf3d.zip .
- name: Base64 encode the build output
run: |
base64 ./wolf3d.zip > wolf3d_base64.txt
- name: Create HTML file
run: |
echo '<!DOCTYPE html>' > wolf3d.html
echo '<html>' >> wolf3d.html
echo '<head>' >> wolf3d.html
echo '<script src="https://js-dos.com/6.22/current/js-dos.js"></script>' >> wolf3d.html
echo '</head>' >> wolf3d.html
echo '<body>' >> wolf3d.html
echo '<h1>Wolfenstein 3D</h1>' >> wolf3d.html
echo '<div id="jsdos" style="width: 640px; height: 400px;"></div>' >> wolf3d.html
echo '<script>' >> wolf3d.html
echo 'async function initDosBox() {' >> wolf3d.html
echo ' const dos = await Dos(ctx, { wdosboxUrl: "https://js-dos.com/6.22/current/wdosbox.js" });' >> wolf3d.html
echo ' const zipFile = `' >> wolf3d.html
cat wolf3d_base64.txt >> wolf3d.html
echo '`;' >> wolf3d.html
echo ' const zipBlob = await fetch("data:application/zip;base64," + zipFile).then(r => r.blob());' >> wolf3d.html
echo ' await dos.fs.extract(zipBlob);' >> wolf3d.html
echo ' dos.run("WOLF3D.EXE");' >> wolf3d.html
echo '}' >> wolf3d.html
echo 'initDosBox();' >> wolf3d.html
echo '</script>' >> wolf3d.html
echo '</body>' >> wolf3d.html
echo '</html>' >> wolf3d.html
- name: Upload HTML file
uses: actions/upload-artifact@v3
with:
name: wolf3d-html
path: wolf3d.html