feat: add portainer deployment step to build-container workflow
changing action to run deployment only on push to main branch
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
name: Build and Deploy Docker Container
|
||||
run-name: ${{ gitea.actor }} runs docker deployment
|
||||
on: [push]
|
||||
# run this workflow on push to main branch
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
@@ -41,3 +45,19 @@ jobs:
|
||||
fi
|
||||
- name: Clean up Docker images
|
||||
run: docker image prune -f
|
||||
|
||||
portainer-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-and-deploy
|
||||
steps:
|
||||
- name: Deploy to Portainer
|
||||
uses: appleboy/ssh-action@v0.1.7
|
||||
with:
|
||||
host: ${{ secrets.SERVER_HOST }}
|
||||
username: ${{ secrets.SERVER_USER }}
|
||||
key: ${{ secrets.SERVER_SSH_KEY }}
|
||||
script: |
|
||||
docker pull git.allucanget.biz/${{ secrets.REGISTRY_USERNAME }}/thc-webhook:latest
|
||||
docker stop thc-webhook || true
|
||||
docker rm thc-webhook || true
|
||||
docker run -d --name thc-webhook -e DISCORD_WEBHOOK_URL=${{ secrets.DISCORD_WEBHOOK_URL }} -p 8080:8080 git.allucanget.biz/${{ secrets.REGISTRY_USERNAME }}/thc-webhook:latest
|
||||
|
||||
Reference in New Issue
Block a user