update metadata (#171) #104
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
name: dev.api.t-pen.org deploy on push to development | |
on: | |
push: | |
branches: development | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Create .env from secrets | |
uses: SpicyPizza/create-envfile@v2 | |
with: | |
envkey_DOWN: ${{ secrets.DOWN }} | |
envkey_READONLY: ${{ secrets.READONLY }} | |
envkey_SERVERURL: ${{ secrets.SERVERURL }} | |
envkey_MONGODBNAME: ${{ secrets.MONGODBNAME }} | |
envkey_MONGODB: ${{ secrets.MONGODB }} | |
envkey_TPENPROJECTS: ${{ secrets.TPENPROJECTS }} | |
envkey_TPENGROUPS: ${{ secrets.TPENGROUPS }} | |
envkey_TPENUSERS: ${{ secrets.TPENUSERS }} | |
envkey_MARIADBNAME: ${{ secrets.MARIADBNAMEDEV }} | |
envkey_MARIADB: ${{ secrets.MARIADB }} | |
envkey_MARIADBUSER: ${{ secrets.MARIADBUSERDEV}} | |
envkey_MARIADBPASSWORD: ${{ secrets.MARIADBPASSWORDDEV }} | |
envkey_RERUMURL: ${{ secrets.RERUMURL }} | |
envkey_RERUMIDPREFIX: ${{ secrets.RERUMIDPREFIXDEV }} | |
envkey_TINYPEN: ${{ secrets.TINYPENDEV }} | |
envkey_AUDIENCE: ${{ secrets.AUDIENCE }} | |
envkey_DOMAIN: ${{ secrets.DOMAIN }} | |
- name: Setup Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: "^22.12.0" | |
- name: Cache node modules | |
uses: actions/cache@master | |
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 and run the test | |
run: | | |
npm install | |
npm run allTests | |
deploy: | |
needs: | |
- test | |
strategy: | |
matrix: | |
machines: | |
- vlcdhp02 | |
runs-on: ${{ matrix.machines }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Deploy the app on the server | |
run: | | |
if [[ ! -e /srv/node/logs/tpen3_services.txt ]]; then | |
mkdir -p /srv/node/logs | |
touch /srv/node/logs/tpen3_services.txt | |
fi | |
cd /srv/node/tpen-services/ | |
pm2 stop tpen3_services | |
git stash | |
git checkout development | |
git pull | |
npm install | |
pm2 -s start -i max bin/tpen3_services.mjs |