Skip to content

Merge branch 'main' of https://github.com/samshiSekki/DSGM_Backend #11

Merge branch 'main' of https://github.com/samshiSekki/DSGM_Backend

Merge branch 'main' of https://github.com/samshiSekki/DSGM_Backend #11

Workflow file for this run

name: Node.js CI # 이 workflow의 이름
on:
push:
branches: [ main ]
jobs:
build: # build라는 job을 정의
runs-on: ubuntu-18.04 # 이 workflow가 수행될 OS 환경 ubuntu-laster
env:
DB_url: ${{ secrets.DATABASE_URL }}
strategy:
matrix:
node-version: [14.x] # 이 workflow 내에서의 변수
steps:
- uses: actions/checkout@v2 # github repo내의 코드를 workflow instance로 가져오는 action 실행 /
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 # nodejs 버전에 따라 workflow를 수행하도록 해주는 action 실행
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present # build, test가 이루어짐
- name: Create .env
# shell: bash
# env:
# DB_url: ${{ secrets.DATABASE_URL }}
run: |
echo "DB_url=$DATABASE_URL" >> .env
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
secrets: DB_url=${{ secrets.DATABASE_URL }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/test:latest
# deploy:
# needs: build
# name: Deploy
# runs-on: [ self-hosted, label-development ]
# steps:
# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Docker run
# run: |
# docker pull ohoh/test:latest
# docker ps -q --filter "name=dsgm" | grep -q . && docker stop dsgm && docker rm -fv dsgm
# docker run -p 5000:5000 -d ${{ secrets.DOCKERHUB_USERNAME }}/test