Merge pull request #19 from SkyLightQP/develop #38
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: 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 |