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

Automatically update docs v2 #7672

Draft
wants to merge 7 commits into
base: dev/feature
Choose a base branch
from
Draft
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
69 changes: 69 additions & 0 deletions .github/workflows/release-docs-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release Documentation v2

on:
release:
types: [published]
push:
branches:
- feature/docs-v2-auto-update

jobs:
build:
name: Generate docs.json
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Build and generate docs.json
run: |
./gradlew genReleaseDocs

- name: Find docs.json
run: |
DOCS_JSON=$(find . -type f | grep docs.json | head -n 1)
if [ -z "$DOCS_JSON" ]; then
echo "docs.json not found"
exit 1
fi
echo "docs.json found at $DOCS_JSON"
echo "docs_json=$DOCS_JSON" >> $GITHUB_ENV

- name: Upload docs.json
uses: actions/upload-artifact@v4
with:
name: docs-json
path: ${{ env.docs_json }}

deploy:
name: Deploy updated docs
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout docs repository
uses: actions/checkout@v4
with:
repository: SkriptLang/docs
token: ${{ secrets.GITHUB_TOKEN }}
path: docs-repo

- name: Download docs.json
uses: actions/download-artifact@v4
with:
name: docs-json
path: docs-repo/src/assets/docs

- name: Commit and push changes
run: |
cd docs-repo
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add src/assets/docs/docs.json
git commit -m "Update docs.json from latest Skript build" || exit 0
git push origin master
Loading