Skip to content

Commit 2bf584a

Browse files
authored
Merge branch 'dev/feature' into feature/github-automation
2 parents 12fcd90 + fd23bc0 commit 2bf584a

File tree

158 files changed

+3822
-3311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+3822
-3311
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
version: 2
22
updates:
33
- package-ecosystem: "github-actions"
4+
target-branch: "dev/patch"
45
directory: "/"
56
schedule:
67
interval: "weekly"
78
labels:
89
- "dependencies"
910
- package-ecosystem: "gradle"
11+
target-branch: "dev/patch"
1012
directory: "/"
1113
schedule:
1214
interval: "weekly"

.github/workflows/cleanup-docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Cleanup nightly documentation
2+
on: delete
3+
jobs:
4+
cleanup-nightly-docs:
5+
if: github.event.ref_type == 'branch'
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Configure workflow
9+
id: configuration
10+
env:
11+
DELETED_BRANCH: ${{ github.event.ref }}
12+
run: |
13+
BRANCH_NAME="${DELETED_BRANCH#refs/*/}"
14+
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
15+
echo "DOCS_OUTPUT_DIR=${GITHUB_WORKSPACE}/skript-docs/docs/nightly/${BRANCH_NAME}" >> $GITHUB_OUTPUT
16+
echo "DOCS_REPO_DIR=${GITHUB_WORKSPACE}/skript-docs" >> $GITHUB_OUTPUT
17+
- name: Checkout Skript
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event.repository.default_branch }}
21+
submodules: recursive
22+
path: skript
23+
- name: Setup documentation environment
24+
uses: ./skript/.github/workflows/docs/setup-docs
25+
with:
26+
docs_deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
27+
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
28+
- name: Cleanup nightly documentation
29+
env:
30+
DOCS_OUTPUT_DIR: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
31+
run: |
32+
rm -rf ${DOCS_OUTPUT_DIR} || true
33+
- name: Push nightly documentation cleanup
34+
uses: ./skript/.github/workflows/docs/push-docs
35+
with:
36+
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
37+
git_name: Nightly Docs Bot
38+
git_email: nightlydocs@skriptlang.org
39+
git_commit_message: "Delete ${{ steps.configuration.outputs.BRANCH_NAME }} branch nightly docs"

.github/workflows/docs/generate-docs/action.yml

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,92 @@ inputs:
1818
required: false
1919
default: false
2020
type: boolean
21+
cleanup_pattern:
22+
description: "A pattern designating which files to delete when cleaning the documentation output directory"
23+
required: false
24+
default: "*"
25+
type: string
26+
generate_javadocs:
27+
description: "Designates whether to generate javadocs for this nightly documentation"
28+
required: false
29+
default: false
30+
type: boolean
31+
32+
outputs:
33+
DOCS_CHANGED:
34+
description: "Whether or not the documentation has changed since the last push"
35+
value: ${{ steps.generate.outputs.DOCS_CHANGED }}
2136

2237
runs:
2338
using: 'composite'
2439
steps:
2540
- name: generate-docs
41+
id: generate
2642
shell: bash
2743
env:
2844
DOCS_OUTPUT_DIR: ${{ inputs.docs_output_dir }}
2945
DOCS_REPO_DIR: ${{ inputs.docs_repo_dir }}
3046
SKRIPT_REPO_DIR: ${{ inputs.skript_repo_dir }}
3147
IS_RELEASE: ${{ inputs.is_release }}
48+
CLEANUP_PATTERN: ${{ inputs.cleanup_pattern }}
49+
GENERATE_JAVADOCS: ${{ inputs.generate_javadocs }}
3250
run: |
33-
export SKRIPT_DOCS_TEMPLATE_DIR=${DOCS_REPO_DIR}/doc-templates
34-
export SKRIPT_DOCS_OUTPUT_DIR=${DOCS_OUTPUT_DIR}/
51+
replace_in_directory() {
52+
find $1 -type f -exec sed -i -e "s/$2/$3/g" {} \;
53+
}
54+
55+
# this should be replaced with a more reliable jq command,
56+
# but it can't be right now because docs.json is actually not valid json.
57+
get_skript_version_of_directory() {
58+
grep skriptVersion "$1/docs.json" | cut -d\" -f 4
59+
}
60+
61+
if [ -d "${DOCS_REPO_DIR}/docs/templates" ]
62+
then
63+
export SKRIPT_DOCS_TEMPLATE_DIR=${DOCS_REPO_DIR}/docs/templates
64+
else # compatibility for older versions
65+
export SKRIPT_DOCS_TEMPLATE_DIR=${DOCS_REPO_DIR}/doc-templates
66+
fi
67+
68+
export SKRIPT_DOCS_OUTPUT_DIR=/tmp/generated-docs
69+
3570
cd $SKRIPT_REPO_DIR
3671
if [[ "${IS_RELEASE}" == "true" ]]; then
3772
./gradlew genReleaseDocs releaseJavadoc
38-
else
73+
elif [[ "${GENERATE_JAVADOCS}" == "true" ]]; then
3974
./gradlew genNightlyDocs javadoc
75+
else
76+
./gradlew genNightlyDocs
4077
fi
41-
cp -a "./build/docs/javadoc/." "${DOCS_OUTPUT_DIR}/javadocs"
78+
79+
if [ -d "${DOCS_OUTPUT_DIR}" ]; then
80+
if [[ "${GENERATE_JAVADOCS}" == "true" ]]; then
81+
mkdir -p "${SKRIPT_DOCS_OUTPUT_DIR}/javadocs" && cp -a "./build/docs/javadoc/." "$_"
82+
fi
83+
84+
mkdir -p "/tmp/normalized-output-docs" && cp -a "${DOCS_OUTPUT_DIR}/." "$_"
85+
mkdir -p "/tmp/normalized-generated-docs" && cp -a "${SKRIPT_DOCS_OUTPUT_DIR}/." "$_"
86+
87+
output_skript_version=$(get_skript_version_of_directory "/tmp/normalized-output-docs")
88+
generated_skript_version=$(get_skript_version_of_directory "/tmp/normalized-generated-docs")
89+
90+
replace_in_directory "/tmp/normalized-output-docs" "${output_skript_version}" "Skript"
91+
replace_in_directory "/tmp/normalized-generated-docs" "${generated_skript_version}" "Skript"
92+
93+
diff -qbr /tmp/normalized-output-docs /tmp/normalized-generated-docs || diff_exit_code=$?
94+
# If diff exits with exit code 1, that means there were some differences
95+
if [[ ${diff_exit_code} -eq 1 ]]; then
96+
echo "DOCS_CHANGED=true" >> $GITHUB_OUTPUT
97+
echo "Documentation has changed since last push"
98+
else
99+
echo "Documentation hasn't changed since last push"
100+
fi
101+
else
102+
echo "DOCS_CHANGED=true" >> $GITHUB_OUTPUT
103+
echo "No existing documentation found"
104+
fi
105+
106+
rm -rf ${DOCS_OUTPUT_DIR}/${CLEANUP_PATTERN} || true
107+
mkdir -p "${DOCS_OUTPUT_DIR}/" && cp -a "${SKRIPT_DOCS_OUTPUT_DIR}/." "$_"
108+
109+

.github/workflows/docs/push-docs/action.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
name: Generate documentation
1+
name: Push documentation
22

33
inputs:
4-
docs_output_dir:
5-
description: "The directory to generate the documentation into"
6-
required: true
7-
type: string
84
docs_repo_dir:
95
description: "The skript-docs repository directory"
106
required: true
@@ -38,4 +34,10 @@ runs:
3834
git config user.email "${GIT_EMAIL}"
3935
git add -A
4036
git commit -m "${GIT_COMMIT_MESSAGE}" || (echo "Nothing to push!" && exit 0)
41-
git push origin main
37+
# Attempt rebasing and pushing 5 times in case another job pushes before us
38+
for i in 1 2 3 4 5
39+
do
40+
git pull --rebase -X theirs origin main
41+
git push origin main && break
42+
sleep 5
43+
done

.github/workflows/docs/setup-docs/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ runs:
3838
CLEANUP_PATTERN: ${{ inputs.cleanup_pattern }}
3939
run: |
4040
eval `ssh-agent`
41-
rm -rf ${DOCS_OUTPUT_DIR}/${CLEANUP_PATTERN} || true
4241
echo "$DOCS_DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
4342
mkdir ~/.ssh
4443
ssh-keyscan www.github.com >> ~/.ssh/known_hosts

.github/workflows/java-17-builds.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
with:
1717
submodules: recursive
18+
- name: validate gradle wrapper
19+
uses: gradle/wrapper-validation-action@v1
1820
- name: Set up JDK 17
1921
uses: actions/setup-java@v3
2022
with:

.github/workflows/java-8-builds.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
with:
1717
submodules: recursive
18+
- name: validate gradle wrapper
19+
uses: gradle/wrapper-validation-action@v1
1820
- name: Set up JDK 17
1921
uses: actions/setup-java@v3
2022
with:

.github/workflows/junit-17-builds.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
with:
1717
submodules: recursive
18+
- name: validate gradle wrapper
19+
uses: gradle/wrapper-validation-action@v1
1820
- name: Set up JDK 17
1921
uses: actions/setup-java@v3
2022
with:

.github/workflows/junit-8-builds.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
with:
1717
submodules: recursive
18+
- name: validate gradle wrapper
19+
uses: gradle/wrapper-validation-action@v1
1820
- name: Set up JDK 17
1921
uses: actions/setup-java@v3
2022
with:

.github/workflows/nightly-docs.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,58 @@ name: Nightly documentation
33
on:
44
push:
55
branches:
6-
- '**'
6+
- 'dev/feature'
7+
- 'dev/patch'
8+
- 'enhancement/**'
9+
- 'feature/**'
10+
- 'fix/**'
711
tags-ignore:
812
- '**'
913

1014
jobs:
1115
nightly-docs:
12-
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
16+
if: "!contains(toJSON(github.event.commits.*.message), '[ci skip]')"
1317
runs-on: ubuntu-latest
1418
steps:
1519
- name: Configure workflow
1620
id: configuration
21+
env:
22+
DOCS_DEPLOY_KEY: ${{ secrets.DOCS_DEPLOY_KEY }}
1723
run: |
24+
if [ -n "$DOCS_DEPLOY_KEY" ]
25+
then
26+
echo "DOCS_DEPLOY_KEY_PRESENT=true" >> $GITHUB_OUTPUT
27+
else
28+
echo "Secret 'DOCS_DEPLOY_KEY' not present. Exiting job."
29+
fi
1830
BRANCH_NAME="${GITHUB_REF#refs/*/}"
1931
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
2032
echo "DOCS_OUTPUT_DIR=${GITHUB_WORKSPACE}/skript-docs/docs/nightly/${BRANCH_NAME}" >> $GITHUB_OUTPUT
2133
echo "DOCS_REPO_DIR=${GITHUB_WORKSPACE}/skript-docs" >> $GITHUB_OUTPUT
2234
echo "SKRIPT_REPO_DIR=${GITHUB_WORKSPACE}/skript" >> $GITHUB_OUTPUT
2335
- name: Checkout Skript
24-
uses: actions/checkout@v3
36+
uses: actions/checkout@v4
2537
with:
2638
submodules: recursive
2739
path: skript
2840
- name: Setup documentation environment
41+
if: steps.configuration.outputs.DOCS_DEPLOY_KEY_PRESENT == 'true'
2942
uses: ./skript/.github/workflows/docs/setup-docs
3043
with:
3144
docs_deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
3245
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
3346
- name: Generate documentation
47+
id: generate
48+
if: steps.configuration.outputs.DOCS_DEPLOY_KEY_PRESENT == 'true'
3449
uses: ./skript/.github/workflows/docs/generate-docs
3550
with:
3651
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
3752
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
3853
skript_repo_dir: ${{ steps.configuration.outputs.SKRIPT_REPO_DIR }}
3954
- name: Push nightly documentation
55+
if: steps.generate.outputs.DOCS_CHANGED == 'true'
4056
uses: ./skript/.github/workflows/docs/push-docs
4157
with:
42-
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
4358
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
4459
git_name: Nightly Docs Bot
4560
git_email: nightlydocs@skriptlang.org

.github/workflows/release-docs.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
echo "DOCS_REPO_DIR=${GITHUB_WORKSPACE}/skript-docs" >> $GITHUB_OUTPUT
1818
echo "SKRIPT_REPO_DIR=${GITHUB_WORKSPACE}/skript" >> $GITHUB_OUTPUT
1919
- name: Checkout Skript
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121
with:
2222
submodules: recursive
2323
path: skript
@@ -26,14 +26,14 @@ jobs:
2626
with:
2727
docs_deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
2828
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
29-
cleanup_pattern: "!(nightly|archives)"
3029
- name: Generate documentation
3130
uses: ./skript/.github/workflows/docs/generate-docs
3231
with:
3332
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
3433
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
3534
skript_repo_dir: ${{ steps.configuration.outputs.SKRIPT_REPO_DIR }}
3635
is_release: true
36+
cleanup_pattern: "!(nightly|archives|templates)"
3737
- name: Push release documentation
3838
uses: ./skript/.github/workflows/docs/push-docs
3939
with:
@@ -56,7 +56,7 @@ jobs:
5656
echo "DOCS_REPO_DIR=${GITHUB_WORKSPACE}/skript-docs" >> $GITHUB_OUTPUT
5757
echo "SKRIPT_REPO_DIR=${GITHUB_WORKSPACE}/skript" >> $GITHUB_OUTPUT
5858
- name: Checkout Skript
59-
uses: actions/checkout@v3
59+
uses: actions/checkout@v4
6060
with:
6161
submodules: recursive
6262
path: skript
@@ -68,14 +68,12 @@ jobs:
6868
- name: Generate documentation
6969
uses: ./skript/.github/workflows/docs/generate-docs
7070
with:
71-
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
7271
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
7372
skript_repo_dir: ${{ steps.configuration.outputs.SKRIPT_REPO_DIR }}
7473
is_release: true
7574
- name: Push archive documentation
7675
uses: ./skript/.github/workflows/docs/push-docs
7776
with:
78-
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
7977
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
8078
git_name: Archive Docs Bot
8179
git_email: archivedocs@skriptlang.org

.github/workflows/repo.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ jobs:
88
publish:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
with:
1313
submodules: recursive
14+
- name: validate gradle wrapper
15+
uses: gradle/wrapper-validation-action@v1
1416
- name: Set up JDK 17
1517
uses: actions/setup-java@v3
1618
with:

0 commit comments

Comments
 (0)