-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (32 loc) · 1.03 KB
/
deploy-web.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: deploy-web
on:
workflow_dispatch:
push:
branches:
- main
env:
NAME: daegyeome
jobs:
check-lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout the source code.
uses: actions/checkout@master
- name: Install dependencies
run: yarn install
- name: Run eslint
run: yarn run lint
deploy:
runs-on: self-hosted
steps:
- name: Checkout the source code.
uses: actions/checkout@master
- name: Build a Dockerfile
run: docker build -t $NAME:latest $(for i in $(grep -vE '^#|^$' ${{ secrets.ENV_PATH }}); do out+="--build-arg $i " ; done; echo $out;out="") .
- name: If running a container, remove it
run: docker ps -q --filter "name=$NAME" | grep -q . && docker stop $NAME && docker rm $NAME || true
- name: Start a docker container
run: docker run -d -p ${{ secrets.PORT }}:3000 --env-file=${{ secrets.ENV_PATH }} --restart=unless-stopped --name $NAME $NAME:latest