-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new GitHub Action for test examples
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |