-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
21,690 additions
and
105 deletions.
There are no files selected for viewing
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
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 |
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
Oops, something went wrong.