Skip to content

moved: deploy.yaml

moved: deploy.yaml #1

Workflow file for this run

name: BogoSort_2024_2 deploy
on:
push:
branches: [main, develop, TP-*]
pull_request:
branches: [main, develop, TP-*]
jobs:
run-linters:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: false
- name: Run linters
uses: golangci/golangci-lint-action@v3
with:
version: v1.56.2
run-tests:
needs: run-linters
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Get dependencies
run: go get ./...
- name: Build application
run: go build ./...
- name: Run tests for application
run: go test ./...
deploy:
if: github.ref == 'refs/heads/main'
needs: [run-linters, run-tests]
runs-on: ubuntu-latest
steps:
- name: Deploy to Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
cd /home/${{ secrets.USERNAME }}/server/back
git checkout develop
git fetch && git pull
sudo docker-compose build
sudo docker-compose down
sudo docker-compose up -d --build --remove-orphans