a ver si de esta funciona #37
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 to Cloudflare Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| - name: Extract OnlyOffice Assets | |
| run: | | |
| DS_VERSION="9.3.1" | |
| ASSET_DIR="public/v9.3.1-1" | |
| mkdir -p $ASSET_DIR | |
| # Usamos el método de extracción limpia con tar para evitar que Docker se quede colgado | |
| docker run --rm --entrypoint /bin/bash onlyoffice/documentserver:$DS_VERSION -c " \ | |
| /usr/bin/documentserver-generate-allfonts.sh false >&2 && \ | |
| cp /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/api.js.tpl /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/api.js && \ | |
| tar -cC /var/www/onlyoffice/documentserver sdkjs web-apps fonts" | tar -xC $ASSET_DIR/ | |
| # Corregimos los permisos ya que los archivos extraídos pueden pertenecer a root | |
| # y además pueden venir como solo lectura | |
| sudo chown -R $USER:$USER $ASSET_DIR | |
| chmod -R u+w $ASSET_DIR | |
| - name: Fix HTML paths and Base Href | |
| run: | | |
| # Ejecutamos el script que ya tenemos en el repo para arreglar los HTML | |
| node update_html.js | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Clean Next.js Cache | |
| run: rm -rf .next | |
| - name: Build | |
| run: pnpm build | |
| env: | |
| NEXT_PUBLIC_APP_ROOT: /v9.3.1-1 | |
| - name: Create Cloudflare Pages project | |
| run: | | |
| pnpm exec wrangler pages project create inled-office --production-branch main || true | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy out --project-name=inled-office |