Merge pull request #2 from n0rrman/dev #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: 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 }} |