Fix CI/CD workflow
All checks were successful
Docker Build and Push (Multi-architecture) / build-and-push (push) Successful in 27s
All checks were successful
Docker Build and Push (Multi-architecture) / build-and-push (push) Successful in 27s
This commit is contained in:
@@ -41,23 +41,23 @@ jobs:
|
||||
${{ 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
|
||||
}'
|
||||
run: |
|
||||
STACK_RESPONSE=$(curl -s -X GET \
|
||||
"${{ vars.PORTAINER_URL }}/api/stacks" \
|
||||
-H "X-API-Key: ${{ secrets.PORTAINER_API_KEY }}")
|
||||
|
||||
STACK_ID=$(echo $STACK_RESPONSE | jq -r '.[] | select(.Name == "${{ vars.STACK_NAME }}") | .Id')
|
||||
|
||||
curl -X PUT \
|
||||
"${{ vars.PORTAINER_URL }}/api/endpoints/${{ vars.ENDPOINT_ID }}/stacks/$STACK_ID" \
|
||||
-H "X-API-Key: ${{ secrets.PORTAINER_API_KEY }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"pullImage": true,
|
||||
"prune": true
|
||||
}'
|
||||
|
||||
echo "Deployment triggered for stack ID: $STACK_ID"
|
||||
continue-on-error: false
|
||||
|
||||
- name: Verify deployment
|
||||
|
||||
Reference in New Issue
Block a user