Skip to content

Commit

Permalink
github action added for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
n0rrman committed May 26, 2024
1 parent 60cab7f commit c9368dc
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: deploy

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Build Docker image
run: docker build -t $DOCKER_IMAGE .
env:
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}

- name: Docker Hub login
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

- name: Push Docker image
run: docker push $DOCKER_IMAGE
env:
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}

- name: Deploy to Swarm
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: docker stack deploy -c ${{ secrets.YAML_PATH }} ${{ secrets.SERVICE_NAME }}

0 comments on commit c9368dc

Please sign in to comment.