Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix portainer domain #244

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/actions/swarm-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ inputs:
IMAGE_TAG:
required: true
description: image tag to deploy to
PORTAINER_DOMAIN:
required: true
description: Portainer Domain
default: "deploy.signalwire.cloud"
outputs:
DEPLOYED_DATE:
description: 'date and time that image was deployed'
Expand All @@ -22,14 +26,14 @@ runs:
id: deploy
shell: bash
run: |
curl -s -H "X-API-Key: ${{env.PORTAINER_API_KEY}}" https://deploy.signalwire.cloud/api/endpoints/${{env.ENDPOINT_ID}}/docker/services/${{ inputs.STACK_NAME }} > service.spec.json
curl -s -H "X-API-Key: ${{env.PORTAINER_API_KEY}}" https://${{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}}" https://deploy.signalwire.cloud/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}}" https://${{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
6 changes: 6 additions & 0 deletions .github/workflows/cd-swarm-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ on:
type: string
description: Another option to set ENDPOINT_ID.
default: ''
PORTAINER_DOMAIN:
required: true
type: string
description: Portainer Domain
default: deploy.signalwire.cloud
secrets:
ENDPOINT_ID:
required: false
Expand Down Expand Up @@ -102,6 +107,7 @@ jobs:
with:
STACK_NAME: ${{ inputs.STACK_NAME }}
IMAGE_TAG: ${{ inputs.IMAGE_TAG }}
PORTAINER_DOMAIN: ${{ inputs.PORTAINER_DOMAIN }}

- uses: ./actions/.github/actions/slack
if: always()
Expand Down