Merge pull request #200 from Tizzz-555/navbar-tooltip #23
Workflow file for this run
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: Web deploy | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install | |
run: npm ci | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: stagecodes | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push Docker Image | |
run: | | |
docker build -t stagecodes/otr-web-prod:latest . | |
docker push stagecodes/otr-web-prod:latest | |
deploy: | |
environment: Production | |
needs: publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Create .env files | |
run: | | |
echo "${{ secrets.ENV }}" > .env | |
- name: Copy files to server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
source: ".env" | |
target: "~/otr-web/" | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
docker pull stagecodes/otr-web-prod:latest | |
docker stop otr-web-prod || true | |
docker rm otr-web-prod || true | |
docker run -d -p 3000:3000 --restart always --name otr-web-prod --env-file ~/otr-web/.env stagecodes/otr-web-prod:latest |