Update Prettier configuration and modify CI/CD workflow to use npm #56
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: CI/CD | |
on: | |
push: | |
branches: [master] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
name: Run Prettier and ESLint | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm install | |
- name: Run Prettier and ESLint | |
run: | | |
npm run format:check | |
npm run lint | |
build-and-deploy: | |
needs: lint | |
runs-on: ubuntu-latest | |
name: Build and Deploy | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Copying files to server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
port: ${{ secrets.REMOTE_PORT }} | |
key: ${{ secrets.SSH_KEY }} | |
rm: true | |
strip_components: 1 | |
source: "dist/*" | |
target: ${{ secrets.REMOTE_DIR }} |