Skip to content

Bump path-to-regexp and express #348

Bump path-to-regexp and express

Bump path-to-regexp and express #348

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Deployment CI
on: [ push, pull_request ]
jobs:
# BUILD PROJECT AND DEPENDENCIES
build:
# if: "!contains(github.event.head_commit.message, 'ci skip')"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 20.12.x ]
steps:
- uses: actions/checkout@v4
- name: Cache project node-modules
uses: actions/cache@v4
with:
path: 'node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Installing NX
run: npm install -g nx@15.9.2
# pipeline actions
- run: npm ci
- name: Build blog Dashboard (prod)
run: npm run build:admin:prod
# run: nx run dashboard:build:production
- name: Build blog Blog (prod)
run: npm run build:ssr
# run: nx run blog:build:production && nx run blog:server:production
# RUN TESTS
test:
needs: [ build ]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 20.12.x ]
steps:
- uses: actions/checkout@v4
- name: Cache project node-modules
uses: actions/cache@v4
with:
path: 'node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install codecov dependency
run: npm install -g codecov
# pipeline actions
# - run: npm run lint # toDo: until lint is fixed
- run: npm test
- run: codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# DEPLOY DASHBOARD (DEVELOP)
deploy-dashboard-dev:
needs: [ test ]
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy project to the hosting
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: ""
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.DEV__REMOTE_TARGET }}
- name: Deploy project with docker in hosting
uses: garygrossgarten/github-action-ssh@release
with:
command: cd ${{ secrets.DEV__REMOTE_TARGET }} && ENVIRONMENT=dev PORT_FRONTEND=${{ secrets.DEV__PORT_FRONTEND_DASHBOARD }} ./docker/deploy.sh blog-admin-dev docker/docker-compose.admin.yml
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
privateKey: ${{ secrets.SERVER_SSH_KEY}}
# DEPLOY BLOG (DEVELOP)
deploy-blog-dev:
needs: [ deploy-dashboard-dev ]
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy project to the hosting
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: ""
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.DEV__REMOTE_TARGET }}
- name: Deploy project with docker in hosting
uses: garygrossgarten/github-action-ssh@release
with:
command: cd ${{ secrets.DEV__REMOTE_TARGET }} && ENVIRONMENT=dev PORT_FRONTEND=${{ secrets.DEV__PORT_FRONTEND_BLOG }} ./docker/deploy.sh blog-frontend-dev docker/docker-compose.yml
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
privateKey: ${{ secrets.SERVER_SSH_KEY}}
# UPDATE APPLICATION VERSION
update-version:
needs: [ test ]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 20.12.x ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Update app version in package.json
run: node ./docker/update-version.js
- name: Commit and push changes
run: ./docker/commit-version.sh
# DEPLOY DASHBOARD (PRODUCTION)
deploy-dashboard-prod:
needs: [ update-version ]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy project to the hosting
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.PROD__SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: ""
REMOTE_HOST: ${{ secrets.PROD__REMOTE_HOST }}
REMOTE_USER: ${{ secrets.PROD__REMOTE_USER }}
TARGET: ${{ secrets.PROD__REMOTE_TARGET }}
- name: Deploy project with docker in hosting
uses: garygrossgarten/github-action-ssh@release
with:
command: cd ${{ secrets.PROD__REMOTE_TARGET }} && PORT_FRONTEND=${{ secrets.PROD__PORT_FRONTEND_DASHBOARD }} ./docker/deploy.sh dashboard-prod-v4 docker/docker-compose.admin.yml
host: ${{ secrets.PROD__REMOTE_HOST }}
username: ${{ secrets.PROD__REMOTE_USER }}
privateKey: ${{ secrets.PROD__SERVER_SSH_KEY}}
# DEPLOY BLOG (PRODUCTION)
deploy-blog-prod:
needs: [ deploy-dashboard-prod ]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy project to the hosting
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.PROD__SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: ""
REMOTE_HOST: ${{ secrets.PROD__REMOTE_HOST }}
REMOTE_USER: ${{ secrets.PROD__REMOTE_USER }}
TARGET: ${{ secrets.PROD__REMOTE_TARGET }}
- name: Deploy project with docker in hosting
uses: garygrossgarten/github-action-ssh@release
with:
command: cd ${{ secrets.PROD__REMOTE_TARGET }} && PORT_FRONTEND=${{ secrets.PROD__PORT_FRONTEND_BLOG }} ./docker/deploy.sh frontend-prod-v4 docker/docker-compose.yml
host: ${{ secrets.PROD__REMOTE_HOST }}
username: ${{ secrets.PROD__REMOTE_USER }}
privateKey: ${{ secrets.PROD__SERVER_SSH_KEY}}