mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
188 lines
5.9 KiB
188 lines
5.9 KiB
name: Update ABP Studio Docs
|
|
|
|
on:
|
|
repository_dispatch:
|
|
types: [update_studio_docs]
|
|
|
|
jobs:
|
|
update-docs:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
models: read
|
|
|
|
steps:
|
|
# -----------------------------
|
|
# Validate payload (safe)
|
|
# -----------------------------
|
|
- name: Validate payload
|
|
run: |
|
|
required_keys=(version name notes url target_branch)
|
|
for key in "${required_keys[@]}"; do
|
|
value="$(jq -r --arg k "$key" '.client_payload[$k] // ""' "$GITHUB_EVENT_PATH")"
|
|
if [ -z "$value" ] || [ "$value" = "null" ]; then
|
|
echo "Missing payload field: $key"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# -----------------------------
|
|
# Checkout target branch
|
|
# -----------------------------
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.client_payload.target_branch }}
|
|
fetch-depth: 0
|
|
|
|
- name: Configure git
|
|
run: |
|
|
git config user.name "docs-bot"
|
|
git config user.email "docs-bot@users.noreply.github.com"
|
|
|
|
# -----------------------------
|
|
# Create working branch
|
|
# -----------------------------
|
|
- name: Create branch
|
|
run: |
|
|
VERSION="${{ github.event.client_payload.version }}"
|
|
BRANCH="docs/studio-${VERSION}"
|
|
git checkout -B "$BRANCH"
|
|
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
|
|
|
# -----------------------------
|
|
# Prepare raw release notes
|
|
# -----------------------------
|
|
- name: Save raw release notes
|
|
run: |
|
|
mkdir -p .tmp
|
|
jq -r '.client_payload.notes' "$GITHUB_EVENT_PATH" > .tmp/raw-notes.txt
|
|
|
|
# -----------------------------
|
|
# Try AI formatting (optional)
|
|
# -----------------------------
|
|
- name: Generate release notes with AI (optional)
|
|
id: ai
|
|
continue-on-error: true
|
|
uses: actions/ai-inference@v1
|
|
with:
|
|
model: openai/gpt-4.1
|
|
prompt: |
|
|
You are a technical writer.
|
|
|
|
Convert the following release notes into concise, user-facing bullet points.
|
|
Rules:
|
|
- Use "-" bullets
|
|
- Keep it short and clear
|
|
- Skip internal / irrelevant details
|
|
|
|
Release notes:
|
|
${{ github.event.client_payload.notes }}
|
|
|
|
# -----------------------------
|
|
# Decide final notes (AI or fallback)
|
|
# -----------------------------
|
|
- name: Decide final release notes
|
|
run: |
|
|
if [ -n "${{ steps.ai.outputs.response }}" ]; then
|
|
echo "Using AI-formatted release notes"
|
|
echo "${{ steps.ai.outputs.response }}" > .tmp/final-notes.txt
|
|
else
|
|
echo "AI unavailable – using raw release notes"
|
|
sed 's/^/- /' .tmp/raw-notes.txt > .tmp/final-notes.txt
|
|
fi
|
|
|
|
# -----------------------------
|
|
# Update release-notes.md
|
|
# -----------------------------
|
|
- name: Update release-notes.md
|
|
run: |
|
|
FILE="docs/en/studio/release-notes.md"
|
|
VERSION="${{ github.event.client_payload.version }}"
|
|
NAME="${{ github.event.client_payload.name }}"
|
|
URL="${{ github.event.client_payload.url }}"
|
|
|
|
mkdir -p docs/en/studio
|
|
touch "$FILE"
|
|
|
|
if grep -q "## Version $VERSION" "$FILE"; then
|
|
echo "Release notes already contain $VERSION, skipping"
|
|
exit 0
|
|
fi
|
|
|
|
{
|
|
echo "## Version $VERSION - $NAME"
|
|
echo ""
|
|
cat .tmp/final-notes.txt
|
|
echo ""
|
|
echo "[Release Link]($URL)"
|
|
echo ""
|
|
echo "---"
|
|
echo ""
|
|
} | cat - "$FILE" > "$FILE.new"
|
|
|
|
mv "$FILE.new" "$FILE"
|
|
|
|
# -----------------------------
|
|
# Update version-mapping.md
|
|
# -----------------------------
|
|
- name: Update version-mapping.md
|
|
run: |
|
|
FILE="docs/en/studio/version-mapping.md"
|
|
VERSION="${{ github.event.client_payload.version }}"
|
|
|
|
mkdir -p docs/en/studio
|
|
if [ ! -f "$FILE" ]; then
|
|
echo "| Studio Version | ABP Version |" > "$FILE"
|
|
echo "|---------------|-------------|" >> "$FILE"
|
|
fi
|
|
|
|
if ! grep -q "| $VERSION |" "$FILE"; then
|
|
echo "| $VERSION | dev |" >> "$FILE"
|
|
fi
|
|
|
|
# -----------------------------
|
|
# Check for changes
|
|
# -----------------------------
|
|
- name: Check for changes
|
|
id: changes
|
|
run: |
|
|
git add docs/en/studio
|
|
if git diff --cached --quiet; then
|
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
# -----------------------------
|
|
# Commit & push
|
|
# -----------------------------
|
|
- name: Commit & push
|
|
if: steps.changes.outputs.has_changes == 'true'
|
|
run: |
|
|
git commit -m "docs(studio): update docs for ${{ github.event.client_payload.version }}"
|
|
git push -u origin "$BRANCH"
|
|
|
|
# -----------------------------
|
|
# Create PR
|
|
# -----------------------------
|
|
- name: Create PR
|
|
if: steps.changes.outputs.has_changes == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.BOT_SECRET }}
|
|
run: |
|
|
gh pr create \
|
|
--title "docs(studio): release ${{ github.event.client_payload.version }}" \
|
|
--body "Automated documentation update for ABP Studio." \
|
|
--base "${{ github.event.client_payload.target_branch }}" \
|
|
--head "$BRANCH"
|
|
|
|
# -----------------------------
|
|
# Enable auto-merge (branch protection safe)
|
|
# -----------------------------
|
|
- name: Enable auto-merge
|
|
if: steps.changes.outputs.has_changes == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.BOT_SECRET }}
|
|
run: |
|
|
gh pr merge "$BRANCH" --squash --auto --admin
|
|
|