🚀 Deploy Docs to Github pages #68
This file contains hidden or 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
| name: 🚀 Deploy Docs to Github pages | |
| on: | |
| workflow_run: | |
| workflows: ["Build Firmware"] | |
| types: | |
| - completed | |
| # Grant permissions for the deployment | |
| permissions: | |
| actions: read | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # Only run on successful workflow completion | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: ⬇️ Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: ⬇️ Download Factory Firmware Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: firmware-factory | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| - name: ⬇️ Download OTA Firmware Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: firmware-ota | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| - name: 🛠️ Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: 📦 Install and Prepare Assets | |
| run: | | |
| # Change directory to docs | |
| cd docs | |
| # 1. Install dependencies (ffmpeg-wasm + marked) | |
| npm install | |
| # 2. Prepare the distribution folder | |
| mkdir -p dist | |
| cp transcode.html dist/ | |
| cp *.js dist/ | |
| # 3. Create firmware folder and copy files | |
| mkdir -p dist/firmware | |
| # Note: download-artifact creates a directory named after the artifact | |
| cp ../firmware-factory.bin dist/firmware/firmware.bin | |
| cp ../firmware.bin dist/firmware/firmware-ota.bin | |
| cp firmware/manifest.json dist/firmware/ | |
| # 4. Compile README.md into dist/index.html | |
| npm run md-to-html | |
| # 5. Copy STL files and images | |
| cp -r ../assets dist/assets | |
| # 6. Manually copy the ffmpeg-wasm core files from node_modules/ | |
| mkdir -p dist/ffmpeg | |
| mkdir -p dist/ffmpeg-util | |
| cp node_modules/@ffmpeg/ffmpeg/dist/esm/* dist/ffmpeg/ | |
| cp node_modules/@ffmpeg/util/dist/esm/* dist/ffmpeg-util/ | |
| - name: 📤 Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: 'docs/dist' | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: 🚀 Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |