mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
asd
This commit is contained in:
parent
605135a47f
commit
71e58643a8
100
.github/workflows/translate_af.yml
vendored
100
.github/workflows/translate_af.yml
vendored
@ -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
|
|
@ -1,4 +1,4 @@
|
|||||||
name: Translator to ES (Spanish)
|
name: Translate All
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -11,26 +11,54 @@ on:
|
|||||||
- Dockerfile
|
- Dockerfile
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency: es
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-translation:
|
translate:
|
||||||
|
name: Translate → ${{ matrix.name }} (${{ matrix.branch }})
|
||||||
runs-on: ubuntu-latest
|
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:
|
container:
|
||||||
image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest
|
image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest
|
||||||
environment: prod
|
|
||||||
env:
|
env:
|
||||||
LANGUAGE: Spanish
|
LANGUAGE: ${{ matrix.language }}
|
||||||
BRANCH: es
|
BRANCH: ${{ matrix.branch }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@ -76,6 +104,7 @@ jobs:
|
|||||||
cat /tmp/file_paths.txt
|
cat /tmp/file_paths.txt
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
|
touch /tmp/file_paths.txt
|
||||||
|
|
||||||
if [ -s /tmp/file_paths.txt ]; then
|
if [ -s /tmp/file_paths.txt ]; then
|
||||||
python scripts/translator.py \
|
python scripts/translator.py \
|
100
.github/workflows/translate_de.yml
vendored
100
.github/workflows/translate_de.yml
vendored
@ -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
|
|
100
.github/workflows/translate_el.yml
vendored
100
.github/workflows/translate_el.yml
vendored
@ -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
|
|
100
.github/workflows/translate_fr.yml
vendored
100
.github/workflows/translate_fr.yml
vendored
@ -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
|
|
100
.github/workflows/translate_hi.yml
vendored
100
.github/workflows/translate_hi.yml
vendored
@ -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
|
|
100
.github/workflows/translate_it.yml
vendored
100
.github/workflows/translate_it.yml
vendored
@ -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
|
|
100
.github/workflows/translate_ja.yml
vendored
100
.github/workflows/translate_ja.yml
vendored
@ -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
|
|
100
.github/workflows/translate_ko.yml
vendored
100
.github/workflows/translate_ko.yml
vendored
@ -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
|
|
100
.github/workflows/translate_pl.yml
vendored
100
.github/workflows/translate_pl.yml
vendored
@ -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
|
|
100
.github/workflows/translate_pt.yml
vendored
100
.github/workflows/translate_pt.yml
vendored
@ -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
|
|
100
.github/workflows/translate_sr.yml
vendored
100
.github/workflows/translate_sr.yml
vendored
@ -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
|
|
100
.github/workflows/translate_sw.yml
vendored
100
.github/workflows/translate_sw.yml
vendored
@ -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
|
|
100
.github/workflows/translate_tr.yml
vendored
100
.github/workflows/translate_tr.yml
vendored
@ -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
|
|
100
.github/workflows/translate_uk.yml
vendored
100
.github/workflows/translate_uk.yml
vendored
@ -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
|
|
100
.github/workflows/translate_zh.yml
vendored
100
.github/workflows/translate_zh.yml
vendored
@ -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
|
|
Loading…
x
Reference in New Issue
Block a user