From 567dac4fd4257372dd9e391a1f8ec31c31dcef71 Mon Sep 17 00:00:00 2001 From: Fabio Bettio Date: Mon, 4 Nov 2024 09:39:21 +0100 Subject: [PATCH] Add new GitHub Action for test examples --- .github/workflows/02-examples.yml | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/02-examples.yml diff --git a/.github/workflows/02-examples.yml b/.github/workflows/02-examples.yml new file mode 100644 index 00000000..42e482e0 --- /dev/null +++ b/.github/workflows/02-examples.yml @@ -0,0 +1,51 @@ +name: Build and Deploy OpenLIME Examples + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + # Permette di eseguire manualmente il workflow + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build library + run: npm run rollup + + - name: Setup and start web server + run: | + # Installa un server web leggero + npm install -g http-server + + # Avvia il server in background dalla directory dist + nohup npx http-server ./dist -p 8080 & + + # Aspetta che il server sia pronto + sleep 5 + + # Verifica che il server sia attivo + curl http://localhost:8080 || exit 1 + + # Optional: deploy to GitHub Pages + - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist \ No newline at end of file