Merge pull request #3335 from 1c-syntax/translations_docs-contributin… #962
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
paths: | |
- 'docs/**' | |
- 'src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/**' | |
- 'src/main/java/**' | |
- 'mkdocs.yml' | |
- 'mkdocs.en.yml' | |
- '.github/workflows/gh-pages.yml' | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: gradle | |
- name: Build javadoc | |
run: ./gradlew --no-daemon javadoc | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.7.15' | |
architecture: 'x64' | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install mkdocs mkdocs-material pygments-bsl | |
- name: Dowload latest GitHub Pages | |
run: | | |
wget https://github.com/${{ github.repository }}/archive/gh-pages.zip || true | |
unzip gh-pages.zip || true | |
mkdir tmp-bench | |
- name: Save latest Develop | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir public | |
mkdir public/dev | |
cp -R ${GITHUB_REPOSITORY#*/}-gh-pages/dev/. public/dev || true | |
- name: Save latest Master | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
mkdir public | |
cp -R ${GITHUB_REPOSITORY#*/}-gh-pages/. public || true | |
rm -rf public/dev || true | |
mkdir public/dev | |
- name: Backup benchmark (master) | |
if: github.ref == 'refs/heads/master' | |
run: | | |
cp -R ${GITHUB_REPOSITORY#*/}-gh-pages/bench/. tmp-bench || true | |
- name: Backup benchmark (develop) | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
cp -R ${GITHUB_REPOSITORY#*/}-gh-pages/dev/bench/. tmp-bench || true | |
- name: Patch Develop | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
sed -i "s%BSL Language Server%BSL Language Server Dev%g" mkdocs.yml | |
sed -i "s%BSL Language Server%BSL Language Server Dev%g" mkdocs.en.yml | |
sed -i "s%https://1c-syntax.github.io/bsl-language-server%https://1c-syntax.github.io/bsl-language-server/dev%g" mkdocs.yml | |
sed -i "s%https://1c-syntax.github.io/bsl-language-server%https://1c-syntax.github.io/bsl-language-server/dev%g" mkdocs.en.yml | |
sed -i "s%link: /bsl-language-server/%link: /bsl-language-server/dev/%g" mkdocs.yml | |
sed -i "s%link: /bsl-language-server/%link: /bsl-language-server/dev/%g" mkdocs.en.yml | |
- name: Build documentation | |
run: | | |
./gradlew generateDiagnosticDocs --build | |
./gradlew generateDiagnosticsIndex --build | |
- name: Build Russian | |
run: | | |
mkdir temp | |
cp mkdocs.yml temp | |
cp -R docs/. temp/docs | |
mkdir temp/docs/configuration | |
cp -R src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/. temp/docs/configuration | |
rm -rf temp/docs/en | |
cd temp | |
mkdocs build | |
- name: Copy benchmark | |
run: | | |
cp -R tmp-bench/. temp/site/bench | |
rm -rf tmp-bench | |
- name: Copy javadoc | |
run: | | |
cp -R build/docs/javadoc temp/site/javadoc | |
echo "" > temp/site/.nojekyll | |
- name: Public Russian Master | |
if: github.ref == 'refs/heads/master' | |
run: | | |
cp -R temp/site/. public | |
- name: Public Russian Develop | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
cp -R temp/site/. public/dev | |
- name: Clean temp | |
run: rm -rf temp | |
- name: Build English | |
run: | | |
mkdir temp | |
cp mkdocs.en.yml temp/mkdocs.yml | |
mkdir temp/docs | |
cp -R docs/en/. temp/docs | |
mkdir temp/docs/assets | |
cp -R docs/assets/. temp/docs/assets | |
mkdir temp/docs/configuration | |
cp -R src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/. temp/docs/configuration | |
cd temp | |
mkdocs build | |
- name: Public English Master | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir public/en | |
cp -R temp/site/. public/en | |
- name: Public English Develop | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
mkdir public/dev/en | |
cp -R temp/site/. public/dev/en | |
- name: Deploy | |
uses: peaceiris/[email protected] | |
with: | |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
publish_branch: gh-pages | |
publish_dir: ./public |