Skip to content

Commit

Permalink
Merge pull request #1 from n0rrman/dev
Browse files Browse the repository at this point in the history
deployment github action added
  • Loading branch information
n0rrman authored Apr 30, 2024
2 parents ba44266 + 5c39c89 commit f3bad9d
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 f3bad9d

Please sign in to comment.