feat: añadido chromium para puppetter y subido timeout #3
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: Generate LiaScript Outputs | |
| # Trigger: Run the workflow when changes are pushed to the 'main' branch. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Check out the repository's code to project directory. | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: project | |
| # Step 2: Set up Node.js environment. | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22' # Specify the Node.js version. | |
| # Step 2.1: Install Chromium for Puppeteer (required by LiaScript exporter for PDF) | |
| - name: Install Chromium | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y chromium-browser | |
| # Step 3: Install the LiaScript exporter globally using npm. | |
| - name: Install LiaScript Exporter | |
| run: | | |
| npm install -g @liascript/exporter | |
| # Step 4: Generate a PDF from CURSO.md. | |
| - name: Generate PDF | |
| run: | | |
| PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \ | |
| liaex -i project/CURSO.md --format pdf --output documentation-${{ github.event.repository.name }} --pdf-timeout 80000 | |
| # Step 5: Generate a SCORM package. | |
| - name: Generate SCORM | |
| run: | | |
| liaex -i project/CURSO.md --format scorm2004 --output scorm-${{ github.event.repository.name }} | |
| # Step 6: Generate an IMS package. | |
| - name: Generate IMS Package | |
| run: | | |
| liaex -i project/CURSO.md --format ims --output ims-${{ github.event.repository.name }} | |
| # Step 7: Create a new GitHub release for the generated assets. | |
| - name: Delete existing 'latest' release (if any) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release delete latest -y --cleanup-tag || true | |
| - name: Create New Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: 'latest' | |
| release_name: 'Última documentación de LiaScript - ${{ github.event.repository.name }}' | |
| draft: false | |
| prerelease: false | |
| # Step 8: Upload the generated PDF as a release asset. | |
| - name: Upload PDF as Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: documentation-${{ github.event.repository.name }}.pdf | |
| asset_name: documentation-${{ github.event.repository.name }}.pdf | |
| asset_content_type: application/pdf | |
| # Step 9: Upload the generated SCORM package. | |
| - name: Upload SCORM as Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: scorm-${{ github.event.repository.name }}.zip | |
| asset_name: scorm-${{ github.event.repository.name }}.zip | |
| asset_content_type: application/zip | |
| # Step 10: Upload the generated IMS package. | |
| - name: Upload IMS as Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ims-${{ github.event.repository.name }}.zip | |
| asset_name: ims-${{ github.event.repository.name }}.zip | |
| asset_content_type: application/zip |