Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
kcwww committed Jan 4, 2024
2 parents 7d0b364 + 8fd80dd commit aacbabd
Show file tree
Hide file tree
Showing 59 changed files with 21,690 additions and 105 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/BackEnd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: ["BE/main"]

jobs:
# test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4

# - name: Use Node.js 20.5.1
# uses: actions/setup-node@v4
# with:
# node-version: 20.5.1

# - name: Install package
# run: npm install
# working-directory: ./back

# - name: npm build
# run: npm run build --if-present
# working-directory: ./back

# - name: npm test
# run: npm test
# working-directory: ./back
build_docker:
# needs: test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
context: ./back
push: true
tags: ghcr.io/yunuo46/was_test:latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: yunuo46
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./back
push: true
tags: ghcr.io/yunuo46/was_test:latest
deploy_docker:
needs: build_docker
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: SSH Version Check
run: ssh -V

- name: Deploy to Server via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
ssh -i ~/.ssh/id_rsa [email protected] << 'EOF'
echo "${{ secrets.ENV_FILE }}" > .env
echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u yunuo46 --password-stdin
docker pull ghcr.io/yunuo46/was_test:latest
docker stop was_test || true
docker rm was_test || true
docker run -d --name was_test -p 3000:3000 --env-file .env ghcr.io/yunuo46/was_test:latest
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# compiled output
back/dist
back/node_modules
back/.env
back/test
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
*/node_modules
/.pnp
Expand All @@ -23,4 +27,4 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

*/.env
*/.env
Loading

0 comments on commit aacbabd

Please sign in to comment.