Add auto container redeploy to CI/CD
Some checks failed
Docker Build and Push (Multi-architecture) / build-and-push (push) Failing after 27s
Some checks failed
Docker Build and Push (Multi-architecture) / build-and-push (push) Failing after 27s
This commit is contained in:
@@ -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 }}"
|
||||||
Reference in New Issue
Block a user