Update example #2
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 | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Harper CLI | |
| run: npm install -g harperdb | |
| - name: Setup Harper | |
| env: | |
| TC_AGREEMENT: 'yes' | |
| HDB_ADMIN_USERNAME: 'admin' | |
| HDB_ADMIN_PASSWORD: 'password' | |
| ROOTPATH: '/tmp/hdb' | |
| OPERATIONSAPI_NETWORK_PORT: 9925 | |
| LOGGING_LEVEL: 'debug' | |
| LOGGING_STDSTREAMS: true | |
| THREADS_COUNT: 1 | |
| THREADS_DEBUG: false | |
| run: harperdb install | |
| - name: Deploy data | |
| run: | | |
| harperdb start | |
| sleep 10 | |
| harperdb deploy project=basic-data package=HarperDB/basic-data-example replicated=true | |
| sleep 10 | |
| harperdb stop | |
| - name: Build project | |
| run: npm run build | |
| - name: Add prebuilt flag to config | |
| run: yq e '.["@harperdb/nextjs"].prebuilt = true' -i config.yaml | |
| - name: Upload HarperDB logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: harperdb-logs | |
| path: /tmp/hdb/log/hdb.log | |
| retention-days: 7 | |
| - name: Deploy | |
| env: | |
| HDB_TARGET: ${{ secrets.HDB_TARGET }} | |
| HDB_USERNAME: ${{ secrets.HDB_USERNAME }} | |
| HDB_PASSWORD: ${{ secrets.HDB_PASSWORD }} | |
| run: | | |
| harperdb deploy \ | |
| target="$HDB_TARGET" \ | |
| username="$HDB_USERNAME" \ | |
| password="$HDB_PASSWORD" \ | |
| project=nextjs-example \ | |
| skip_node_modules=false \ | |
| restart=true \ | |
| replicated=true |