merge AI branch #402
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: Web Deploy | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: [ self-hosted, gingkowriter ] | |
defaults: | |
run: | |
working-directory: client | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Setup bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Checkout client | |
uses: actions/checkout@v3 | |
with: | |
path: client | |
- name: Checkout server | |
uses: actions/checkout@v3 | |
with: | |
repository: gingko/server | |
path: server | |
- name: Create data directory | |
run: mkdir -p ../data | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Copy client config.js file | |
run: cp $HOME/client.config.js $GITHUB_WORKSPACE/client/config.js | |
- name: Check client config.js file | |
run: node $GITHUB_WORKSPACE/client/config-check.js | |
- name: Copy client hidden-config.js file | |
run: cp $HOME/client.hidden-config.js $GITHUB_WORKSPACE/client/hidden-config.js | |
- name: Copy server config.js file | |
run: cp $HOME/server.config.js $GITHUB_WORKSPACE/server/config.js | |
- name: Check server config.js file | |
run: node $GITHUB_WORKSPACE/server/config-check.js | |
- name: Install Test Server Dependencies | |
run: cd ../server; npm i; npx tsc | |
- name: Stop Test Server | |
run: "pm2 stop --silent GingkoTest || :" | |
- name: Start Test Server | |
run: NODE_ENV=production DEBUG=cards PORT=8000 pm2 start ../server/dist/index.js --name GingkoTest | |
- run: bun i | |
- run: bun run newbuild | |
- name: Playwright e2e Tests | |
run: bun run test | |
- name: Cypress e2e Tests | |
run: bunx cypress run | |
- name: Stop Test Server | |
run: pm2 stop GingkoTest | |
- name: Copy Build Files | |
if: "!contains(github.event.head_commit.message, 'ci skip deploy')" | |
run: | | |
cp -r $GITHUB_WORKSPACE/client/web/* $HOME/production/client/web | |
cp -r $GITHUB_WORKSPACE/server/* $HOME/production/server | |
- name: Restart Production Server | |
if: "!contains(github.event.head_commit.message, 'ci skip deploy')" | |
run: pm2 restart GingkoProductionNew |