34 lines
757 B
YAML
34 lines
757 B
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image
|
|
run: docker build .
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
steps:
|
|
- name: Redeploy Portainer stack
|
|
run: |
|
|
curl -X POST "${{ vars.PORTAINER_URL }}/api/stacks/${{ vars.PORTAINER_STACK_ID }}/git/redeploy?endpointId=${{ vars.PORTAINER_ENDPOINT_ID }}" \
|
|
-H "X-API-Key: ${{ secrets.PORTAINER_API_KEY }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"pullImage": true}'
|