Deploy Flutter through Dokploy webhook
All checks were successful
Build and deploy Flutter Web / build (push) Successful in 2m12s

This commit is contained in:
Ruslan Bakiev
2026-05-09 14:44:03 +07:00
parent f5f59d3020
commit 8cf2b29143

View File

@@ -10,8 +10,9 @@ jobs:
runs-on: build-host
env:
SERVICE_NAME: flutter
IMAGE: gitea.dsrptlab.com/mapflow/flutter:${{ github.sha }}
DOKPLOY_APPLICATION_ID: 9UR7Tpp9v_I6Ueu04sUiu
IMAGE_SHA: gitea.dsrptlab.com/mapflow/flutter:${{ github.sha }}
IMAGE_MAIN: gitea.dsrptlab.com/mapflow/flutter:main
DOKPLOY_DEPLOY_WEBHOOK: http://sin.dsrptlab.com:3000/api/deploy/b7iCKmvlGMU-2HmI79fcC
steps:
- uses: actions/checkout@v4
@@ -38,7 +39,8 @@ jobs:
docker buildx inspect --bootstrap
docker buildx build \
--push \
--tag "$IMAGE" \
--tag "$IMAGE_SHA" \
--tag "$IMAGE_MAIN" \
--build-arg MAPBOX_ACCESS_TOKEN="${{ secrets.MAPBOX_ACCESS_TOKEN }}" \
--build-arg MAPBOX_STYLE="mapbox/streets-v12" \
--build-arg TELEGRAM_BOT_USERNAME="carfteebot" \
@@ -54,30 +56,16 @@ jobs:
echo "A newer main commit exists: $latest_sha. Skipping deploy for ${GITHUB_SHA}."
fi
- name: Update Dokploy image
- name: Trigger Dokploy webhook
run: |
set -euo pipefail
[ -f .deploy-current ] || exit 0
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
)
curl -fsS -X POST "${{ secrets.DOKPLOY_URL }}/api/application.saveDockerProvider" \
-H "x-api-key: ${{ secrets.DOKPLOY_TOKEN }}" \
-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 }}" \
curl -fsS -X POST "$DOKPLOY_DEPLOY_WEBHOOK" \
-H "x-gitea-event: push" \
-H "Content-Type: application/json" \
-d "$payload"