Merge pull request #10 from prateek-srivastava001/master #2
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: Build and Deploy to Server | |
on: | |
push: | |
branches: | |
- master # Adjust the branch as needed | |
jobs: | |
deploy-to-server: | |
runs-on: ubuntu-latest | |
# needs: build-and-push | |
steps: | |
- name: SSH and Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_KEY }} | |
port: 22 | |
script: | | |
cd devsoc-backend-24/ | |
git pull origin main | |
sudo -S docker compose down | |
sudo -S docker compose up -d --build | |
# build-and-push: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v2 | |
# - name: "Create env file" | |
# run: | | |
# echo "${{ secrets.ENV }}" > .env | |
# cat .env | |
# - name: Build Go backend Docker image | |
# run: | | |
# docker build -t shivam2002/bolt-backend:latest . | |
# env: | |
# DOCKER_BUILDKIT: 1 # Enable BuildKit for improved build performance | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# - name: Push Docker image to Docker Hub | |
# run: | | |
# docker push shivam2002/bolt-backend:latest | |
# env: | |
# DOCKER_BUILDKIT: 1 # Enable BuildKit for improved build performance | |