added text #128
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push] | |
jobs: | |
render_scad_files: | |
runs-on: ubuntu-latest | |
container: | |
image: bbassett/openscad | |
name: render_scad_files | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: create stl files | |
run: > | |
mkdir publish ; | |
for f in $(find . -name "*.scad"); do | |
if [[ $(basename "$f") != "common.scad" ]]; then | |
openscad -o publish/$(basename ${f//\.scad/.stl}) ${f}; | |
fi | |
done | |
shell: bash | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: workspace_artifacts | |
path: | | |
${{ github.workspace }}/publish/*.stl | |
- name: Update and install dependencies | |
run: | | |
sed -i -e 's/deb http:\/\/deb.debian.org\/debian stable main/deb http:\/\/deb.debian.org\/debian buster main/' \ | |
-e 's/deb http:\/\/security.debian.org\/debian-security stable\/updates main/deb http:\/\/deb.debian.org\/debian-security buster\/updates main/' \ | |
-e 's/deb http:\/\/deb.debian.org\/debian stable-updates main/deb http:\/\/deb.debian.org\/debian buster-updates main/' \ | |
/etc/apt/sources.list | |
apt-get update -q | |
apt-get install -y xvfb rsync #rsync for deploy step on github pages | |
- name: create png files | |
run: > | |
for f in $(find . -name "*.scad"); do | |
if [[ $(basename "$f") != "common.scad" ]]; then | |
xvfb-run -a openscad -o publish/$(basename ${f//\.scad/.png}) ${f}; | |
fi | |
done | |
shell: bash | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: workspace_artifacts | |
path: | | |
${{ github.workspace }}/publish/*.png | |
- name: Generate HTML | |
run: | | |
cd publish | |
echo "<html><body><table>" > index.html | |
echo "<tr>" > temp_row.html | |
for img in *.png; do | |
source_file=https://github.com/naelolaiz/3d_models/tree/main/$(find .. -name ${img//\.png/.scad} | sed 's/^\.\.\///g') | |
echo "<td><a href='${source_file}'><img src='$img' width='300'></a><br/><a href='${img//\.png/.stl}'>${img//\.png/.stl}</a></td>" >> temp_row.html | |
if [ $(($(wc -l < temp_row.html) % 5)) -eq 0 ]; then | |
cat temp_row.html >> index.html | |
echo "</tr><tr>" > temp_row.html | |
fi | |
done | |
echo "</tr>" >> temp_row.html | |
cat temp_row.html >> index.html | |
echo "</table></body></html>" >> index.html | |
shell: bash | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: ./publish |