Skip to content

🚀 Test deploy

🚀 Test deploy #12

Workflow file for this run

name: Production
on:
pull_request:
branches: [ "production" ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
dockerize:
name: Dockerize
needs: build
runs-on: ubuntu-latest
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
PROJECT: ${{ secrets.PROJECT }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Login to DockerHub
run: |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- name: Build and push
run: |
docker build -t $DOCKER_USERNAME/$PROJECT -f src/EcoLink.Bot/Dockerfile .
docker push $DOCKER_USERNAME/$PROJECT
deploy:
name: Deploy
needs: dockerize
runs-on: ubuntu-latest
steps:
- name: SSH into AWS Ubuntu Server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: |
cd ~/eco-link
docker-compose pull
docker-compose up -d