Skip to content

Commit

Permalink
Merge branch 'dev/feature' into feature/expr-skull-owner
Browse files Browse the repository at this point in the history
  • Loading branch information
APickledWalrus authored Jul 1, 2024
2 parents adf4f78 + 7111887 commit a08e76a
Show file tree
Hide file tree
Showing 666 changed files with 29,507 additions and 11,621 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .git-blame-ignore-revs

# cleanup lang package - mostly renaming variables
98abf5d7773df11c65d66e4e9485d0f1e3ef8821
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
version: 2
updates:
- package-ecosystem: "github-actions"
target-branch: "dev/patch"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
- package-ecosystem: "gradle"
target-branch: "dev/patch"
directory: "/"
schedule:
interval: "weekly"
Expand Down
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<!--- Describe your changes here. --->

---
**Target Minecraft Versions:** <!-- 'any' means all supported versions -->
**Requirements:** <!-- Required plugins, Minecraft versions, server software... -->
**Related Issues:** <!-- Links to related issues -->
**Target Minecraft Versions:** any <!-- 'any' means all supported versions -->
**Requirements:** none <!-- Required plugins, server software... -->
**Related Issues:** none <!-- Links to related issues -->
45 changes: 45 additions & 0 deletions .github/workflows/archive-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Archive documentation

on:
release:
types: [published]
workflow_dispatch:

jobs:
archive-docs:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
needs: release-docs
runs-on: ubuntu-latest
steps:
- name: Configure workflow
id: configuration
run: |
echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "DOCS_OUTPUT_DIR=${GITHUB_WORKSPACE}/skript-docs/docs/archives/${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "DOCS_REPO_DIR=${GITHUB_WORKSPACE}/skript-docs" >> $GITHUB_OUTPUT
echo "SKRIPT_REPO_DIR=${GITHUB_WORKSPACE}/skript" >> $GITHUB_OUTPUT
- name: Checkout Skript
uses: actions/checkout@v4
with:
submodules: recursive
path: skript
- name: Setup documentation environment
uses: ./skript/.github/workflows/docs/setup-docs
with:
docs_deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
- name: Generate documentation
uses: ./skript/.github/workflows/docs/generate-docs
with:
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
skript_repo_dir: ${{ steps.configuration.outputs.SKRIPT_REPO_DIR }}
is_release: true
generate_javadocs: true
- name: Push archive documentation
uses: ./skript/.github/workflows/docs/push-docs
with:
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
git_name: Archive Docs Bot
git_email: archivedocs@skriptlang.org
git_commit_message: "Update ${{ steps.configuration.outputs.BRANCH_NAME }} archive docs"
39 changes: 39 additions & 0 deletions .github/workflows/cleanup-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Cleanup nightly documentation
on: delete
jobs:
cleanup-nightly-docs:
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Configure workflow
id: configuration
env:
DELETED_BRANCH: ${{ github.event.ref }}
run: |
BRANCH_NAME="${DELETED_BRANCH#refs/*/}"
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "DOCS_OUTPUT_DIR=${GITHUB_WORKSPACE}/skript-docs/docs/nightly/${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "DOCS_REPO_DIR=${GITHUB_WORKSPACE}/skript-docs" >> $GITHUB_OUTPUT
- name: Checkout Skript
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
submodules: recursive
path: skript
- name: Setup documentation environment
uses: ./skript/.github/workflows/docs/setup-docs
with:
docs_deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
- name: Cleanup nightly documentation
env:
DOCS_OUTPUT_DIR: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
run: |
rm -rf ${DOCS_OUTPUT_DIR} || true
- name: Push nightly documentation cleanup
uses: ./skript/.github/workflows/docs/push-docs
with:
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
git_name: Nightly Docs Bot
git_email: nightlydocs@skriptlang.org
git_commit_message: "Delete ${{ steps.configuration.outputs.BRANCH_NAME }} branch nightly docs"
59 changes: 0 additions & 59 deletions .github/workflows/docs.yml

This file was deleted.

109 changes: 109 additions & 0 deletions .github/workflows/docs/generate-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Generate documentation

inputs:
docs_output_dir:
description: "The directory to generate the documentation into"
required: true
type: string
docs_repo_dir:
description: "The skript-docs repository directory"
required: true
type: string
skript_repo_dir:
description: "The skript repository directory"
required: true
type: string
is_release:
description: "Designates whether to generate nightly or release documentation"
required: false
default: false
type: boolean
cleanup_pattern:
description: "A pattern designating which files to delete when cleaning the documentation output directory"
required: false
default: "*"
type: string
generate_javadocs:
description: "Designates whether to generate javadocs for this nightly documentation"
required: false
default: false
type: boolean

outputs:
DOCS_CHANGED:
description: "Whether or not the documentation has changed since the last push"
value: ${{ steps.generate.outputs.DOCS_CHANGED }}

runs:
using: 'composite'
steps:
- name: generate-docs
id: generate
shell: bash
env:
DOCS_OUTPUT_DIR: ${{ inputs.docs_output_dir }}
DOCS_REPO_DIR: ${{ inputs.docs_repo_dir }}
SKRIPT_REPO_DIR: ${{ inputs.skript_repo_dir }}
IS_RELEASE: ${{ inputs.is_release }}
CLEANUP_PATTERN: ${{ inputs.cleanup_pattern }}
GENERATE_JAVADOCS: ${{ inputs.generate_javadocs }}
run: |
replace_in_directory() {
find $1 -type f -exec sed -i -e "s/$2/$3/g" {} \;
}
# this should be replaced with a more reliable jq command,
# but it can't be right now because docs.json is actually not valid json.
get_skript_version_of_directory() {
grep skriptVersion "$1/docs.json" | cut -d\" -f 4
}
if [ -d "${DOCS_REPO_DIR}/docs/templates" ]
then
export SKRIPT_DOCS_TEMPLATE_DIR=${DOCS_REPO_DIR}/docs/templates
else # compatibility for older versions
export SKRIPT_DOCS_TEMPLATE_DIR=${DOCS_REPO_DIR}/doc-templates
fi
export SKRIPT_DOCS_OUTPUT_DIR=/tmp/generated-docs
cd $SKRIPT_REPO_DIR
if [[ "${IS_RELEASE}" == "true" ]]; then
./gradlew genReleaseDocs javadoc
elif [[ "${GENERATE_JAVADOCS}" == "true" ]]; then
./gradlew genNightlyDocs javadoc
else
./gradlew genNightlyDocs
fi
if [ -d "${DOCS_OUTPUT_DIR}" ]; then
if [[ "${GENERATE_JAVADOCS}" == "true" ]] || [[ "${IS_RELEASE}" == "true" ]] ; then
mkdir -p "${SKRIPT_DOCS_OUTPUT_DIR}/javadocs" && cp -a "./build/docs/javadoc/." "$_"
fi
mkdir -p "/tmp/normalized-output-docs" && cp -a "${DOCS_OUTPUT_DIR}/." "$_"
mkdir -p "/tmp/normalized-generated-docs" && cp -a "${SKRIPT_DOCS_OUTPUT_DIR}/." "$_"

output_skript_version=$(get_skript_version_of_directory "/tmp/normalized-output-docs")
generated_skript_version=$(get_skript_version_of_directory "/tmp/normalized-generated-docs")

replace_in_directory "/tmp/normalized-output-docs" "${output_skript_version}" "Skript"
replace_in_directory "/tmp/normalized-generated-docs" "${generated_skript_version}" "Skript"

diff -qbr /tmp/normalized-output-docs /tmp/normalized-generated-docs || diff_exit_code=$?
# If diff exits with exit code 1, that means there were some differences
if [[ ${diff_exit_code} -eq 1 ]]; then
echo "DOCS_CHANGED=true" >> $GITHUB_OUTPUT
echo "Documentation has changed since last push"
else
echo "Documentation hasn't changed since last push"
fi
else
echo "DOCS_CHANGED=true" >> $GITHUB_OUTPUT
echo "No existing documentation found"
fi

rm -rf ${DOCS_OUTPUT_DIR}/${CLEANUP_PATTERN} || true
mkdir -p "${DOCS_OUTPUT_DIR}/" && cp -a "${SKRIPT_DOCS_OUTPUT_DIR}/." "$_"


43 changes: 43 additions & 0 deletions .github/workflows/docs/push-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Push documentation

inputs:
docs_repo_dir:
description: "The skript-docs repository directory"
required: true
type: string
git_email:
description: "The email to use for the Git commit"
required: true
type: string
git_name:
description: "The name to use for the Git commit"
required: true
type: string
git_commit_message:
description: "The message to use for the Git commit"
required: true
type: string

runs:
using: 'composite'
steps:
- shell: bash
if: success()
env:
DOCS_REPO_DIR: ${{ inputs.docs_repo_dir }}
GIT_EMAIL: ${{ inputs.git_email }}
GIT_NAME: ${{ inputs.git_name }}
GIT_COMMIT_MESSAGE: ${{ inputs.git_commit_message }}
run: |
cd "${DOCS_REPO_DIR}"
git config user.name "${GIT_NAME}"
git config user.email "${GIT_EMAIL}"
git add -A
git commit -m "${GIT_COMMIT_MESSAGE}" || (echo "Nothing to push!" && exit 0)
# Attempt rebasing and pushing 5 times in case another job pushes before us
for i in 1 2 3 4 5
do
git pull --rebase -X theirs origin main
git push origin main && break
sleep 5
done
43 changes: 43 additions & 0 deletions .github/workflows/docs/setup-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Setup documentation environment

inputs:
docs_deploy_key:
description: "Deploy key for the skript-docs repo"
required: true
type: string
docs_output_dir:
description: "The directory to generate the documentation into"
required: true
type: string
cleanup_pattern:
description: "A pattern designating which files to delete when cleaning the documentation output directory"
required: false
default: "*"
type: string

runs:
using: 'composite'
steps:
- name: Checkout skript-docs
uses: actions/checkout@v3
with:
repository: 'SkriptLang/skript-docs'
path: skript-docs
ssh-key: ${{ inputs.docs_deploy_key }}
- uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'adopt'
cache: gradle
- shell: bash
run: chmod +x ./skript/gradlew
- shell: bash
env:
DOCS_DEPLOY_KEY: ${{ inputs.docs_deploy_key }}
DOCS_OUTPUT_DIR: ${{ inputs.docs_output_dir }}
CLEANUP_PATTERN: ${{ inputs.cleanup_pattern }}
run: |
eval `ssh-agent`
echo "$DOCS_DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
mkdir ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
Loading

0 comments on commit a08e76a

Please sign in to comment.