Merge pull request #98 from Boost-Coder/feature/fixRankType-#00 #42
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: Backend CD | |
on: | |
push: | |
branches: [ "develop" ] | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set env | |
run: | | |
mkdir envs | |
echo "DB_HOST=${{ secrets.DB_HOST }}" >> envs/prod.env | |
echo "DB_PORT=${{ secrets.DB_PORT }}" >> envs/prod.env | |
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> envs/prod.env | |
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> envs/prod.env | |
echo "DB_DATABASE=${{ secrets.DB_DATABASE }}" >> envs/prod.env | |
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> envs/prod.env | |
echo "JWT_EXPIRES_IN=${{ secrets.JWT_EXPIRES_IN }}" >> envs/prod.env | |
echo "JWT_REFRESH_SECRET=${{ secrets.JWT_REFRESH_SECRET }}" >> envs/prod.env | |
echo "JWT_REFRESH_EXPIRES_IN=${{ secrets.JWT_REFRESH_EXPIRES_IN }}" >> envs/prod.env | |
- name: Build docker image | |
run: docker build . -t rankin:latest | |
deploy: | |
needs: build | |
runs-on: self-hosted | |
steps: | |
- name: Stop docker | |
run: | | |
docker stop rankin && docker rm rankin | |
- name: Run docker | |
if: always() | |
run: | | |
docker run --name rankin -d -p 3000:3000 -v /var/rankin/logs:/app/logs rankin:latest | |