diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4a34a2c..9b11022 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -9,14 +9,6 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - - name: Set up known_hosts file run: | mkdir -p ~/.ssh/ && touch ~/.ssh/known_hosts @@ -26,8 +18,6 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_KEY }} - - name: Install PM2 - run: pnpm install -g pm2 - - - name: Deploy - run: pnpm run deploy + - name: Run deploy script + run: | + ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} 'cd ${{ secrets.DEPLOY_PATH }} && ./deploy.sh' diff --git a/.github/workflows/publish-ghcr.yaml b/.github/workflows/publish-ghcr.yaml index b30dc8e..0b762b2 100644 --- a/.github/workflows/publish-ghcr.yaml +++ b/.github/workflows/publish-ghcr.yaml @@ -1,4 +1,4 @@ -name: Publish to GHCR +name: CI / Publish to GHCR on: workflow_dispatch: push: diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 9d41e63..0000000 --- a/deploy.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e - -# Set up and redeploy Gathio. Called by `pm2 deploy`. -# Working directory is the root of the repo. - -# PM2 doesn't load the user env, so this gets nvm into the PATH -export NVM_DIR=~/.nvm -source ~/.nvm/nvm.sh -# Set the right Node version -nvm use -# Need to use `development` here else pnpm won't install devDependencies (i.e. tsc) -NODE_ENV=development pnpm install -# This calls `tsc`, which fails due to type errors while we're transitioning -# fully to TypeScript, so we short-circuit it to true to continue running the -# deploy script. TODO: Remove this short-circuit when we've migrated to -# TypeScript and don't expect any more errors. -pnpm build || true -pm2 reload ecosystem.config.cjs production -pm2 save - -# Build the docs and deploy -mkdocs build -d /var/www/docs.gath.io \ No newline at end of file diff --git a/package.json b/package.json index 628524f..26d1d00 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,7 @@ "start": "node dist/start.js", "dev": "nodemon -e ts,js --watch src --exec \"pnpm run build ; pnpm run start\"", "test:dev": "CYPRESS=true pnpm run dev & wait-on http://localhost:3000 && cypress open --e2e --browser chrome", - "test": "pnpm run build || true && CYPRESS=true pnpm run start & wait-on http://localhost:3000 && cypress run --e2e --browser chrome", - "deploy": "pm2 deploy ecosystem.config.cjs production" + "test": "pnpm run build || true && CYPRESS=true pnpm run start & wait-on http://localhost:3000 && cypress run --e2e --browser chrome" }, "engines": { "node": ">=16.16.0"