docs #209
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: Documentation | |
on: | |
push: | |
branches: | |
- main | |
workflow_run: | |
workflows: | |
- update | |
types: | |
- completed | |
workflow_dispatch: | |
repository_dispatch: | |
types: | |
- docs | |
permissions: write-all | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv | |
coverage: xdebug | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: | | |
npm i | |
composer install | |
- name: Updating the available localizations page | |
run: php app/bin/available-locales.php | |
- name: Clearing translation statuses | |
run: | | |
rm -rf docs/statuses/attributes | |
rm -rf docs/statuses/http-statuses | |
rm -rf docs/statuses/lang | |
mkdir docs/statuses/attributes | |
mkdir docs/statuses/http-statuses | |
mkdir docs/statuses/lang | |
- name: Download repositories | |
run: | | |
git clone --no-tags --single-branch https://github.com/Laravel-Lang/attributes.git tmp/attributes | |
git clone --no-tags --single-branch https://github.com/Laravel-Lang/http-statuses.git tmp/http-statuses | |
git clone --no-tags --single-branch https://github.com/Laravel-Lang/lang.git tmp/lang | |
- name: Move translation statuses | |
run: | | |
mv -f tmp/attributes/docs/status.md docs/statuses/attributes/index.md | |
mv -f tmp/http-statuses/docs/status.md docs/statuses/http-statuses/index.md | |
mv -f tmp/lang/docs/status.md docs/statuses/lang/index.md | |
mv -f tmp/attributes/docs/statuses docs/statuses/attributes/statuses | |
mv -f tmp/http-statuses/docs/statuses docs/statuses/http-statuses/statuses | |
mv -f tmp/lang/docs/statuses docs/statuses/lang/statuses | |
- name: Resolve page names | |
run: | | |
sed -i 's/# Completion Status/# Completion Status: Attributes/g' docs/statuses/attributes/index.md | |
sed -i 's/# Completion Status/# Completion Status: HTTP Statuses/g' docs/statuses/http-statuses/index.md | |
sed -i 's/# Completion Status/# Completion Status: Lang/g' docs/statuses/lang/index.md | |
- name: Resolve navigation links | |
run: | | |
sed -i 's/<\/table>/<\/table>\n\n[ [go back](..\/index.md) | [to top](\#) ]/g' docs/statuses/attributes/index.md | |
sed -i 's/<\/table>/<\/table>\n\n[ [go back](..\/index.md) | [to top](\#) ]/g' docs/statuses/http-statuses/index.md | |
sed -i 's/<\/table>/<\/table>\n\n[ [go back](..\/index.md) | [to top](\#) ]/g' docs/statuses/lang/index.md | |
sed -i 's/..\/status.md/..\/index.md/g' docs/statuses/attributes/statuses/* | |
sed -i 's/..\/status.md/..\/index.md/g' docs/statuses/http-statuses/statuses/* | |
sed -i 's/..\/status.md/..\/index.md/g' docs/statuses/lang/statuses/* | |
- name: Build VuePress site | |
run: npm run build | |
env: | |
VITE_APP_ALGOLIA_APP_ID: ${{ secrets.VITE_APP_ALGOLIA_APP_ID }} | |
VITE_APP_ALGOLIA_API_KEY: ${{ secrets.VITE_APP_ALGOLIA_API_KEY }} | |
VITE_APP_ALGOLIA_INDEX_NAME: ${{ secrets.VITE_APP_ALGOLIA_INDEX_NAME }} | |
- name: Deploy to GitHub Pages | |
uses: crazy-max/[email protected] | |
with: | |
target_branch: gh-pages | |
build_dir: docs/.vuepress/dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |