Deploy worker through Dokploy webhook
All checks were successful
Build and deploy Worker / build (push) Successful in 30s
All checks were successful
Build and deploy Worker / build (push) Successful in 30s
This commit is contained in:
@@ -10,8 +10,9 @@ jobs:
|
|||||||
runs-on: build-host
|
runs-on: build-host
|
||||||
env:
|
env:
|
||||||
SERVICE_NAME: worker
|
SERVICE_NAME: worker
|
||||||
IMAGE: gitea.dsrptlab.com/mapflow/worker:${{ github.sha }}
|
IMAGE_SHA: gitea.dsrptlab.com/mapflow/worker:${{ github.sha }}
|
||||||
DOKPLOY_APPLICATION_ID: WLVTwjBDqYy3vim88NyKX
|
IMAGE_MAIN: gitea.dsrptlab.com/mapflow/worker:main
|
||||||
|
DOKPLOY_DEPLOY_WEBHOOK: http://sin.dsrptlab.com:3000/api/deploy/FqP8dqyUZYCWfMSK4reuM
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
docker buildx use "$builder"
|
docker buildx use "$builder"
|
||||||
docker buildx inspect --bootstrap
|
docker buildx inspect --bootstrap
|
||||||
docker buildx build --push --tag "$IMAGE" .
|
docker buildx build --push --tag "$IMAGE_SHA" --tag "$IMAGE_MAIN" .
|
||||||
|
|
||||||
- name: Skip stale deployment
|
- name: Skip stale deployment
|
||||||
run: |
|
run: |
|
||||||
@@ -43,30 +44,16 @@ jobs:
|
|||||||
echo "A newer main commit exists: $latest_sha. Skipping deploy for ${GITHUB_SHA}."
|
echo "A newer main commit exists: $latest_sha. Skipping deploy for ${GITHUB_SHA}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Update Dokploy image
|
- name: Trigger Dokploy webhook
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
[ -f .deploy-current ] || exit 0
|
[ -f .deploy-current ] || exit 0
|
||||||
payload=$(cat <<JSON
|
payload=$(cat <<JSON
|
||||||
{"applicationId":"$DOKPLOY_APPLICATION_ID","dockerImage":"$IMAGE","username":"${{ secrets.REGISTRY_USERNAME }}","password":"${{ secrets.REGISTRY_TOKEN }}","registryUrl":"gitea.dsrptlab.com"}
|
{"ref":"refs/heads/main","after":"$GITHUB_SHA","commits":[{"id":"$GITHUB_SHA","message":"$SERVICE_NAME #${GITHUB_RUN_NUMBER:-0} ${GITHUB_SHA:0:7}"}]}
|
||||||
JSON
|
JSON
|
||||||
)
|
)
|
||||||
curl -fsS -X POST "${{ secrets.DOKPLOY_URL }}/api/application.saveDockerProvider" \
|
curl -fsS -X POST "$DOKPLOY_DEPLOY_WEBHOOK" \
|
||||||
-H "x-api-key: ${{ secrets.DOKPLOY_TOKEN }}" \
|
-H "x-gitea-event: push" \
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "$payload"
|
|
||||||
|
|
||||||
- name: Deploy in Dokploy
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
[ -f .deploy-current ] || exit 0
|
|
||||||
short_sha="${GITHUB_SHA:0:7}"
|
|
||||||
payload=$(cat <<JSON
|
|
||||||
{"applicationId":"$DOKPLOY_APPLICATION_ID","title":"$SERVICE_NAME #${GITHUB_RUN_NUMBER:-0} $short_sha","description":"Deploy registry image $IMAGE"}
|
|
||||||
JSON
|
|
||||||
)
|
|
||||||
curl -fsS -X POST "${{ secrets.DOKPLOY_URL }}/api/application.deploy" \
|
|
||||||
-H "x-api-key: ${{ secrets.DOKPLOY_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$payload"
|
-d "$payload"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user