diff --git a/.github/actions/swarm-deploy/action.yml b/.github/actions/swarm-deploy/action.yml index e4a3deb9..f2b8ac47 100644 --- a/.github/actions/swarm-deploy/action.yml +++ b/.github/actions/swarm-deploy/action.yml @@ -12,6 +12,10 @@ inputs: required: true description: Portainer Domain default: "deploy.signalwire.cloud" + PORTAINER_DOMAIN_PROTOCOL: + required: true + description: Portainer Protocol + default: "http" outputs: DEPLOYED_DATE: description: 'date and time that image was deployed' @@ -29,14 +33,14 @@ runs: id: deploy shell: bash run: | - curl -s -H "X-API-Key: ${{env.PORTAINER_API_KEY}}" http://${{inputs.PORTAINER_DOMAIN}}/api/endpoints/${{env.ENDPOINT_ID}}/docker/services/${{ inputs.STACK_NAME }} > service.spec.json + curl -s -H "X-API-Key: ${{env.PORTAINER_API_KEY}}" ${{inputs.PORTAINER_DOMAIN_PROTOCOL}}://${{inputs.PORTAINER_DOMAIN}}/api/endpoints/${{env.ENDPOINT_ID}}/docker/services/${{ inputs.STACK_NAME }} > service.spec.json version=$(jq '.Version.Index' service.spec.json) previousimg=$(jq '.Spec.TaskTemplate.ContainerSpec.Image' -r service.spec.json) jq '.Spec.TaskTemplate.ContainerSpec.Image="${{ inputs.IMAGE_TAG}}" | .Spec' service.spec.json > update.spec.json - curl -s -X POST -H "X-API-Key: ${{env.PORTAINER_API_KEY}}" -H "Content-Type: application/json" http://${{inputs.PORTAINER_DOMAIN}}/api/endpoints/${{env.ENDPOINT_ID}}/docker/services/${{ inputs.STACK_NAME }}/update?version=$version -d @update.spec.json + curl -s -X POST -H "X-API-Key: ${{env.PORTAINER_API_KEY}}" -H "Content-Type: application/json" ${{inputs.PORTAINER_DOMAIN_PROTOCOL}}://${{inputs.PORTAINER_DOMAIN}}/api/endpoints/${{env.ENDPOINT_ID}}/docker/services/${{ inputs.STACK_NAME }}/update?version=$version -d @update.spec.json echo PREVIOUS_IMAGE=$previousimg >> $GITHUB_OUTPUT echo DEPLOYED_DATE=$(date -u) >> $GITHUB_OUTPUT diff --git a/.github/workflows/cd-swarm-deploy.yml b/.github/workflows/cd-swarm-deploy.yml index 77d93ecd..9f2fca70 100644 --- a/.github/workflows/cd-swarm-deploy.yml +++ b/.github/workflows/cd-swarm-deploy.yml @@ -46,6 +46,11 @@ on: type: string description: Portainer Domain default: deploy.signalwire.cloud + PORTAINER_DOMAIN_PROTOCOL: + required: true + type: string + description: Portainer Protocol + default: http secrets: ENDPOINT_ID: required: false