Skip to content

Commit

Permalink
fix: CI (#1653)
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenary authored Jan 10, 2024
1 parent e136065 commit a426a89
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 33 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
node-version: "18"
- uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/website/.docusaurus
${{ github.workspace }}/**/.cache
key: |
${{ runner.os }}-docusaurus-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-docusaurus-${{ hashFiles('**/yarn.lock') }}
- name: Build docusaurus
run: |
cd website && yarn
yarn build:preview
env:
NODE_OPTIONS: --max-old-space-size=8192
NODE_OPTIONS: --max-old-space-size=8192
58 changes: 58 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build docs on PR merge

on:
pull_request:
types: [closed]
branches:
- master
workflow_dispatch:

jobs:
merge_job:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- uses: actions/setup-node@v2
with:
node-version: "18"

- uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/website/.docusaurus
${{ github.workspace }}/**/.cache
key: |
${{ runner.os }}-docusaurus-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-docusaurus-${{ hashFiles('**/yarn.lock') }}
- name: Set Git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions"
- name: Merge master back to build
run: |
git fetch
git checkout build
git pull
git merge --no-ff master -m "Auto-merge main back to build"
- name: Install dependencies and build
run: |
cd website
yarn
yarn build
yarn crowdin:upload
- name: Commit build
run: |
git add -f ./website/build
git commit -m "Merge with master"
git push
env:
NODE_OPTIONS: --max-old-space-size=8192
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
29 changes: 0 additions & 29 deletions .github/workflows/crowdin.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/translation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Download translation and build docs

on:
schedule:
- cron: "0 9 * * 1"
workflow_dispatch:

jobs:
merge_job:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"

- uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/website/.docusaurus
${{ github.workspace }}/**/.cache
key: |
${{ runner.os }}-docusaurus-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-docusaurus-${{ hashFiles('**/yarn.lock') }}
- name: Set Git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions"
- name: Checkout and pull build
run: |
git fetch
git checkout build
git pull
- name: Install dependencies and build
run: |
cd website
yarn
yarn crowdin:download
yarn build
- name: Commit build
run: |
git add -f ./website/build
if git commit -m "add new build";then
git push
else
echo "Nothing to commit"
fi
env:
NODE_OPTIONS: --max-old-space-size=8192
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
4 changes: 2 additions & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"full-test": "./test-links.sh test",
"start": "docusaurus start",
"build": "if [ \"$IS_PULL_REQUEST\" = \"true\" ]; then $npm_execpath run build:preview; else $npm_execpath run build:main; fi",
"build:main": "$npm_execpath crowdin:download && docusaurus build",
"build:main": "docusaurus build",
"build:preview": "docusaurus build --locale en",
"swizzle": "docusaurus swizzle",
"docusaurus": "docusaurus",
"remote-sync": "node ./src/utils/getChangelogs.js && npm run docusaurus download-remote-changelog && npm run docusaurus download-remote-dx",
"crowdin": "crowdin",
"crowdin:upload": "docusaurus write-translations && crowdin upload",
"crowdin:download": "docusaurus write-translations && crowdin download"
"crowdin:download": "crowdin download"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.0.1",
Expand Down

1 comment on commit a426a89

@Batifah7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/workflows/build-docs.yml

Please sign in to comment.