Add auto container redeploy to CI/CD

This commit is contained in:
k.eaven committed 2025-09-13 15:55:27 +00:00
1 parent f9c99c0857
commit 9096b7259a
1 file changed
+25 -1
+25 -1
View File
@@ -38,4 +38,28 @@ jobs:
cache-to: type=registry,ref=${{ vars.REGISTRY }}/${{ github.repository_owner }}/${{ vars.IMAGE_NAME }}:cache,mode=max cache-to: type=registry,ref=${{ vars.REGISTRY }}/${{ github.repository_owner }}/${{ vars.IMAGE_NAME }}:cache,mode=max
tags: | tags: |
${{ vars.REGISTRY }}/${{ github.repository_owner }}/${{ vars.IMAGE_NAME }}:latest ${{ vars.REGISTRY }}/${{ github.repository_owner }}/${{ vars.IMAGE_NAME }}:latest
${{ vars.REGISTRY }}/${{ github.repository_owner }}/${{ vars.IMAGE_NAME }}:${{ github.sha }} ${{ vars.REGISTRY }}/${{ github.repository_owner }}/${{ vars.IMAGE_NAME }}:${{ github.sha }}
- name: Deploy to Portainer
id: deploy
uses: fjogeleit/http-request-action@v1
with:
url: ${{ vars.PORTAINER_URL }}/api/stacks/${{ vars.STACK_ID }}/git/redeploy
method: POST
customHeaders: '{
"X-API-Key": "${{ secrets.PORTAINER_API_KEY }}",
"Content-Type": "application/json"
}'
data: '{
"env": [
{"name": "IMAGE_TAG", "value": "${{ github.sha }}"},
{"name": "DEPLOY_TIMESTAMP", "value": "${{ github.run_id }}"}
],
"prune": true,
"pullImage": true
}'
continue-on-error: false
- name: Verify deployment
run: |
echo "Deployment triggered successfully for commit ${{ github.sha }}"