34 lines
858 B
YAML
34 lines
858 B
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Login to Docker Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
registry: docker.io
|
|
|
|
- name: Build and Push Docker Image
|
|
run: |
|
|
docker build -t ${{ secrets.DOCKER_USERNAME }}/web:latest .
|
|
docker push ${{ secrets.DOCKER_USERNAME }}/web:latest
|
|
|
|
- name: Trigger Portainer Webhook
|
|
uses: peter-evans/http-post-action@v1
|
|
with:
|
|
url: ${{ secrets.PORTAINER_WEBHOOK_URL }}
|
|
method: 'POST'
|
|
headers: 'Content-Type: application/json'
|
|
body: '{}'
|