From 71e58643a8f372d17599823e0548f02597dafd58 Mon Sep 17 00:00:00 2001 From: carlospolop Date: Thu, 21 Aug 2025 01:23:57 +0200 Subject: [PATCH] asd --- .github/workflows/translate_af.yml | 100 ------------------ .../{translate_es.yml => translate_all.yml} | 47 ++++++-- .github/workflows/translate_de.yml | 100 ------------------ .github/workflows/translate_el.yml | 100 ------------------ .github/workflows/translate_fr.yml | 100 ------------------ .github/workflows/translate_hi.yml | 100 ------------------ .github/workflows/translate_it.yml | 100 ------------------ .github/workflows/translate_ja.yml | 100 ------------------ .github/workflows/translate_ko.yml | 100 ------------------ .github/workflows/translate_pl.yml | 100 ------------------ .github/workflows/translate_pt.yml | 100 ------------------ .github/workflows/translate_sr.yml | 100 ------------------ .github/workflows/translate_sw.yml | 100 ------------------ .github/workflows/translate_tr.yml | 100 ------------------ .github/workflows/translate_uk.yml | 100 ------------------ .github/workflows/translate_zh.yml | 100 ------------------ 16 files changed, 38 insertions(+), 1509 deletions(-) delete mode 100644 .github/workflows/translate_af.yml rename .github/workflows/{translate_es.yml => translate_all.yml} (77%) delete mode 100644 .github/workflows/translate_de.yml delete mode 100644 .github/workflows/translate_el.yml delete mode 100644 .github/workflows/translate_fr.yml delete mode 100644 .github/workflows/translate_hi.yml delete mode 100644 .github/workflows/translate_it.yml delete mode 100644 .github/workflows/translate_ja.yml delete mode 100644 .github/workflows/translate_ko.yml delete mode 100644 .github/workflows/translate_pl.yml delete mode 100644 .github/workflows/translate_pt.yml delete mode 100644 .github/workflows/translate_sr.yml delete mode 100644 .github/workflows/translate_sw.yml delete mode 100644 .github/workflows/translate_tr.yml delete mode 100644 .github/workflows/translate_uk.yml delete mode 100644 .github/workflows/translate_zh.yml diff --git a/.github/workflows/translate_af.yml b/.github/workflows/translate_af.yml deleted file mode 100644 index d55b626d6..000000000 --- a/.github/workflows/translate_af.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to AF (Afrikaans) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: af - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Afrikaans - BRANCH: af - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_es.yml b/.github/workflows/translate_all.yml similarity index 77% rename from .github/workflows/translate_es.yml rename to .github/workflows/translate_all.yml index 78728f3a1..4ab462e60 100644 --- a/.github/workflows/translate_es.yml +++ b/.github/workflows/translate_all.yml @@ -1,4 +1,4 @@ -name: Translator to ES (Spanish) +name: Translate All on: push: @@ -11,26 +11,54 @@ on: - Dockerfile workflow_dispatch: -concurrency: es - permissions: packages: write id-token: write contents: write jobs: - run-translation: + translate: + name: Translate → ${{ matrix.name }} (${{ matrix.branch }}) runs-on: ubuntu-latest + + # Run N languages in parallel (tune max-parallel if needed) + strategy: + fail-fast: false + # max-parallel: 3 #Nothing to run all in parallel + matrix: + include: + - { name: "Afrikaans", language: "Afrikaans", branch: "af" } + - { name: "German", language: "German", branch: "de" } + - { name: "Greek", language: "Greek", branch: "el" } + - { name: "Spanish", language: "Spanish", branch: "es" } + - { name: "French", language: "French", branch: "fr" } + - { name: "Hindi", language: "Hindi", branch: "hi" } + - { name: "Italian", language: "Italian", branch: "it" } + - { name: "Japanese", language: "Japanese", branch: "ja" } + - { name: "Korean", language: "Korean", branch: "ko" } + - { name: "Polish", language: "Polish", branch: "pl" } + - { name: "Portuguese", language: "Portuguese", branch: "pt" } + - { name: "Serbian", language: "Serbian", branch: "sr" } + - { name: "Swahili", language: "Swahili", branch: "sw" } + - { name: "Turkish", language: "Turkish", branch: "tr" } + - { name: "Ukrainian", language: "Ukrainian", branch: "uk" } + - { name: "Chinese", language: "Chinese", branch: "zh" } + + # Ensure only one job per branch runs at a time (even across workflow runs) + concurrency: + group: translate-${{ matrix.branch }} + cancel-in-progress: false + container: image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod + env: - LANGUAGE: Spanish - BRANCH: es - + LANGUAGE: ${{ matrix.language }} + BRANCH: ${{ matrix.branch }} + steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -76,6 +104,7 @@ jobs: cat /tmp/file_paths.txt echo "" echo "" + touch /tmp/file_paths.txt if [ -s /tmp/file_paths.txt ]; then python scripts/translator.py \ diff --git a/.github/workflows/translate_de.yml b/.github/workflows/translate_de.yml deleted file mode 100644 index 856c2025a..000000000 --- a/.github/workflows/translate_de.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to DE (German) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: de - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: German - BRANCH: de - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_el.yml b/.github/workflows/translate_el.yml deleted file mode 100644 index 08f04ec22..000000000 --- a/.github/workflows/translate_el.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to EL (Greek) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: el - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Greek - BRANCH: el - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_fr.yml b/.github/workflows/translate_fr.yml deleted file mode 100644 index 0076dc72a..000000000 --- a/.github/workflows/translate_fr.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to FR (French) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: fr - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: French - BRANCH: fr - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_hi.yml b/.github/workflows/translate_hi.yml deleted file mode 100644 index 8a9020df7..000000000 --- a/.github/workflows/translate_hi.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to HI (Hindi) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: hi - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Hindi - BRANCH: hi - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_it.yml b/.github/workflows/translate_it.yml deleted file mode 100644 index 21596320d..000000000 --- a/.github/workflows/translate_it.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to IT (Italian) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: it - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Italian - BRANCH: it - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_ja.yml b/.github/workflows/translate_ja.yml deleted file mode 100644 index 2ccf37621..000000000 --- a/.github/workflows/translate_ja.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to JA (Japanese) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: ja - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Japanese - BRANCH: ja - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_ko.yml b/.github/workflows/translate_ko.yml deleted file mode 100644 index 201d832c3..000000000 --- a/.github/workflows/translate_ko.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to KO (Korean) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: ko - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Korean - BRANCH: ko - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_pl.yml b/.github/workflows/translate_pl.yml deleted file mode 100644 index 18b027d1a..000000000 --- a/.github/workflows/translate_pl.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to PL (Polish) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: pl - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Polish - BRANCH: pl - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_pt.yml b/.github/workflows/translate_pt.yml deleted file mode 100644 index a43662aa0..000000000 --- a/.github/workflows/translate_pt.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to PT (Portuguese) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: pt - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Portuguese - BRANCH: pt - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_sr.yml b/.github/workflows/translate_sr.yml deleted file mode 100644 index 2d4028c2b..000000000 --- a/.github/workflows/translate_sr.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to SR (Serbian) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: sr - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Serbian - BRANCH: sr - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_sw.yml b/.github/workflows/translate_sw.yml deleted file mode 100644 index 3bf75184a..000000000 --- a/.github/workflows/translate_sw.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to SW (Swahili) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: sw - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Swahili - BRANCH: sw - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_tr.yml b/.github/workflows/translate_tr.yml deleted file mode 100644 index d2fed560e..000000000 --- a/.github/workflows/translate_tr.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to TR (Turkish) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: tr - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Turkish - BRANCH: tr - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_uk.yml b/.github/workflows/translate_uk.yml deleted file mode 100644 index 5331a7ab9..000000000 --- a/.github/workflows/translate_uk.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to UK (Ukranian) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: uk - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Ukranian - BRANCH: uk - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/.github/workflows/translate_zh.yml b/.github/workflows/translate_zh.yml deleted file mode 100644 index 4fe3f35ef..000000000 --- a/.github/workflows/translate_zh.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Translator to ZH (Chinese) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - - Dockerfile - workflow_dispatch: - -concurrency: zh - -permissions: - packages: write - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - container: - image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest - environment: prod - env: - LANGUAGE: Chinese - BRANCH: zh - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download language branch - run: | - git config --global --add safe.directory /__w/hacktricks/hacktricks - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git config pull.rebase false - git checkout $BRANCH - git pull - git checkout master - - - name: Update & install translator.py (if needed) - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - - name: Run translation script on changed files - run: | - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - fi - done - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - - name: Build mdBook - run: | - git checkout "$BRANCH" - git pull - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) - - - name: Update searchindex.js in repo - run: | - git checkout $BRANCH - git pull - if [ -f "book/searchindex.js" ]; then - cp book/searchindex.js searchindex.js - fi - (git add searchindex.js; - git commit -m "Update searchindex"; - git push) || echo "No changes to searchindex.js" - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: | - echo "Current branch:" - git rev-parse --abbrev-ref HEAD - echo "Syncing $BRANCH to S3" - aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete - echo "Sync completed" - echo "Cat 3 files from the book" - find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat