Merge pull request #279 from CenterForDigitalHumanities/fix-stale-dep… #96
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: RERUM Server v1 Production Deploy on push to main. | |
| on: | |
| push: | |
| branches: main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create .env from secrets | |
| run: echo "${{ secrets.PROD_FULL_ENV }}" > .env | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| # Speed up subsequent runs with caching | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ | |
| hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| ${{ runner.os }}- | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Generate coverage report | |
| run: npm run coverage:ci | |
| deploy: | |
| needs: test | |
| environment: production | |
| strategy: | |
| matrix: | |
| node-version: | |
| - 24 | |
| machines: | |
| - vlcdhprdp02 | |
| runs-on: ${{ matrix.machines }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy the app on the server | |
| run: | | |
| if [[ ! -e /srv/node/logs/rerumv1.txt ]]; then | |
| mkdir -p /srv/node/logs | |
| touch /srv/node/logs/rerumv1.txt | |
| fi | |
| cd /srv/node/v1-node/ | |
| pm2 stop rerum_v1 | |
| git stash | |
| git checkout main | |
| git stash | |
| git pull | |
| npm install | |
| pm2 startOrReload ecosystem.config.json --env production |