fix branch and fetch stack details
This commit is contained in:
@@ -18,7 +18,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: stage
|
ref: main
|
||||||
|
|
||||||
- name: Get the endpoint ID
|
- name: Get the endpoint ID
|
||||||
# Usually ID is 1, but you can get it from the API. Only skip this if you are VERY sure.
|
# Usually ID is 1, but you can get it from the API. Only skip this if you are VERY sure.
|
||||||
@@ -34,10 +34,16 @@ jobs:
|
|||||||
echo "STACK_ID=$STACK_ID" >> $GITHUB_ENV
|
echo "STACK_ID=$STACK_ID" >> $GITHUB_ENV
|
||||||
echo "Got stack ID: $STACK_ID matched with Endpoint ID: $ENDPOINT_ID"
|
echo "Got stack ID: $STACK_ID matched with Endpoint ID: $ENDPOINT_ID"
|
||||||
|
|
||||||
|
- name: Fetch Stack
|
||||||
|
run: |
|
||||||
|
# Get the stack details (including stack file content)
|
||||||
|
curl -s -H "X-API-Key: $PORTAINER_TOKEN" "$PORTAINER_API_URL/stacks/$STACK_ID/file" \
|
||||||
|
| jq -r '.StackFileContent' > stack.yml
|
||||||
|
|
||||||
- name: Update stack in Portainer
|
- name: Update stack in Portainer
|
||||||
run: |
|
run: |
|
||||||
# Read stack file content
|
# Read stack file content
|
||||||
STACK_FILE_CONTENT=$(echo "$(<stage-compose.yml )")
|
STACK_FILE_CONTENT=$(echo "$(<stack.yml )")
|
||||||
|
|
||||||
# Prepare JSON payload
|
# Prepare JSON payload
|
||||||
JSON_PAYLOAD=$(jq -n --arg stackFileContent "$STACK_FILE_CONTENT" --argjson pullImage true \
|
JSON_PAYLOAD=$(jq -n --arg stackFileContent "$STACK_FILE_CONTENT" --argjson pullImage true \
|
||||||
|
|||||||
Reference in New Issue
Block a user