mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
chore: update OpenAPI sync workflow to commit changes
- Re-enabled the steps to commit the generated OpenAPI specification to the website repository. - Improved checks for changes in the OpenAPI spec before committing. - Enhanced commit message formatting for clarity and added a timestamp to the commit.
This commit is contained in:
67
.github/workflows/sync-openapi-docs.yml
vendored
67
.github/workflows/sync-openapi-docs.yml
vendored
@@ -31,46 +31,55 @@ jobs:
|
|||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Generate OpenAPI specification
|
- name: Generate OpenAPI specification
|
||||||
run: pnpm generate:openapi
|
|
||||||
|
|
||||||
- name: Commit OpenAPI spec
|
|
||||||
run: |
|
run: |
|
||||||
git config user.name "Dokploy Bot"
|
pnpm generate:openapi
|
||||||
git config user.email "bot@dokploy.com"
|
|
||||||
|
|
||||||
# Verifica si el archivo existe
|
# Verifica que se generó correctamente
|
||||||
if [ ! -f openapi.json ]; then
|
if [ ! -f openapi.json ]; then
|
||||||
echo "❌ openapi.json not found"
|
echo "❌ openapi.json not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Usa -f para forzar el add de archivos en .gitignore
|
echo "✅ OpenAPI specification generated successfully"
|
||||||
git add -f openapi.json
|
|
||||||
|
- name: Sync to website repository
|
||||||
|
run: |
|
||||||
|
# Clona el repositorio de website
|
||||||
|
git clone https://x-access-token:${{ secrets.DOCS_SYNC_TOKEN }}@github.com/dokploy/website.git website-repo
|
||||||
|
|
||||||
# Verifica si hay cambios para commitear
|
cd website-repo
|
||||||
if git diff --cached --quiet; then
|
|
||||||
echo "📝 No changes detected in OpenAPI spec"
|
# Copia el openapi.json al website
|
||||||
echo "HAS_CHANGES=false" >> $GITHUB_ENV
|
mkdir -p public
|
||||||
|
cp ../openapi.json public/openapi.json
|
||||||
|
|
||||||
|
# Configura git
|
||||||
|
git config user.name "Dokploy Bot"
|
||||||
|
git config user.email "bot@dokploy.com"
|
||||||
|
|
||||||
|
# Verifica si hay cambios
|
||||||
|
if git diff --quiet public/openapi.json; then
|
||||||
|
echo "📝 No changes detected in website repo"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "HAS_CHANGES=true" >> $GITHUB_ENV
|
# Commitea y pushea
|
||||||
|
git add public/openapi.json
|
||||||
# Commit los cambios
|
git commit -m "chore: sync OpenAPI specification [skip ci]" \
|
||||||
git commit -m "chore: update OpenAPI specification [skip ci]" \
|
-m "Source: ${{ github.repository }}@${{ github.sha }}" \
|
||||||
-m "Generated from commit: ${{ github.sha }}" \
|
-m "Updated: $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
|
||||||
-m "Triggered by: ${{ github.event_name }}"
|
|
||||||
|
|
||||||
git push
|
git push
|
||||||
|
|
||||||
echo "✅ OpenAPI spec committed successfully"
|
echo "✅ OpenAPI synced to website successfully"
|
||||||
|
continue-on-error: true
|
||||||
- name: Trigger website sync
|
|
||||||
if: env.HAS_CHANGES == 'true'
|
- name: Create summary
|
||||||
uses: peter-evans/repository-dispatch@v2
|
run: |
|
||||||
with:
|
echo "## 📊 OpenAPI Sync Summary" >> $GITHUB_STEP_SUMMARY
|
||||||
token: ${{ secrets.DOCS_SYNC_TOKEN }}
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
repository: dokploy/website
|
echo "- **Repository:** \`${{ github.repository }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
event-type: openapi-updated
|
echo "- **Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
client-payload: '{"commit": "${{ github.sha }}", "timestamp": "${{ github.event.head_commit.timestamp }}"}'
|
echo "- **Trigger:** \`${{ github.event_name }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- **Target:** \`dokploy/website\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- **Status:** ✅ Success" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user