fix ci/cd cards #33
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: Build and Deploy Cards Project | |
on: | |
push: | |
paths: | |
- 'packages/cards/**' | |
pull_request: | |
paths: | |
- 'packages/cards/**' | |
jobs: | |
install-dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Cache Node modules | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | |
- name: Install Dependencies | |
run: yarn install | |
build-and-test: | |
needs: install-dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Cache Node modules | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | |
- name: Build Shared Modules | |
run: yarn workspace shared build | |
- name: Test Shared Modules | |
run: yarn workspace shared test | |
deploy-cards: | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Cache Node modules | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | |
- name: Build Cards | |
run: yarn workspace cards build | |
- name: Copy files to a temporary directory | |
run: | | |
mkdir cards | |
cp -R packages/cards/dist/* cards/ | |
- name: Deploy to Server | |
uses: appleboy/scp-action@master | |
with: | |
host: 138.68.115.124 | |
username: root | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
source: 'cards/*' | |
target: '/usr/share/nginx/html/microfrontend/apps' |