Skip to content

ci: pkg-lock

ci: pkg-lock #343

Workflow file for this run

name: 'Bump Version'
on:
push:
branches:
- 'main'
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 16.x, 18.x ]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run lint
- run: npm run test
- run: npm run build
release:
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- run: npm install
- run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-image:
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Build Docker Image
run: docker build -t ghcr.io/${{ github.repository }}/tabt-rest:latest .
# Replace "your-nodejs-api" with your desired image name
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker Image to GHCR
run: docker push ghcr.io/${{ github.repository }}/tabt-rest:latest
deploy:
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.12.0
- name: Setup
run: npm install
- name: Build
run: npm run build
- name: Deploy to Server
uses: easingthemes/[email protected]
with:
REMOTE_PORT: ${{ secrets.SSH_REMOTE_PORT }}
TARGET: ${{ secrets.SSH_STAGING_TARGET }}
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_STAGING_PRIVATEKEY }}
ARGS: "-rltgoDzvO"
SOURCE: ""
REMOTE_HOST: ${{ secrets.SSH_STAGING_HOST }}
REMOTE_USER: ${{ secrets.SSH_STAGING_USER }}
REMOTE_PORT: ${{ secrets.SSH_REMOTE_PORT }}
TARGET: ${{ secrets.SSH_STAGING_TARGET }}
- name: Restarting TabT instance
uses: appleboy/ssh-action@master
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
with:
envs: DATABASE_URL
host: ${{ secrets.SSH_STAGING_HOST }}
port: ${{ secrets.SSH_REMOTE_PORT }}
username: ${{ secrets.SSH_STAGING_USER }}
key: ${{ secrets.SSH_STAGING_PRIVATEKEY }}
script: cd ${{ secrets.SSH_STAGING_TARGET }} && npm run prisma:deploy && pm2 reload tabt-rest-pm2.json --env production