Enhance model display script functionality #74
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: Build and Deploy CityGenerator to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build static site (with webpack config) | |
| run: | | |
| if [ -f webpack.config.js ]; then | |
| npx webpack --config webpack.config.js | |
| else | |
| npm run build | |
| fi | |
| - name: Install pm2 globally | |
| run: npm install -g pm2 | |
| - name: Start app with pm2 (for CI test only, not for Pages) | |
| run: | | |
| if [ -f citygenerator.config.js ]; then | |
| pm2 start citygenerator.config.js | |
| else | |
| echo "No PM2 config found, skipping PM2 start." | |
| fi | |
| - name: List pm2 processes (for build logs) | |
| run: pm2 list | |
| - name: Setup GitHub Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload static site artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './dist' # Change if your build output is elsewhere | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |