diff --git a/.github/workflows/build_master.yml b/.github/workflows/build_master.yml new file mode 100644 index 000000000..4ef1dbe77 --- /dev/null +++ b/.github/workflows/build_master.yml @@ -0,0 +1,66 @@ +name: Build Master + +on: + push: + branches: + - master + paths-ignore: + - 'scripts/**' + - '.gitignore' + - '.github/**' + - 'book/**' + workflow_dispatch: + +concurrency: build_master + +permissions: + id-token: write + contents: write + +jobs: + run-translation: + runs-on: ubuntu-latest + environment: prod + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 #Needed to download everything to be able to access the master & language branches + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # Cat hacktricks-preprocessor.log + #- name: Cat hacktricks-preprocessor.log + # run: cat hacktricks-preprocessor.log + + # 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: aws s3 sync ./book s3://hacktricks-wiki/en --delete + \ No newline at end of file diff --git a/.github/workflows/translate_af.yml b/.github/workflows/translate_af.yml index 67cefc78a..19aaa50ed 100644 --- a/.github/workflows/translate_af.yml +++ b/.github/workflows/translate_af.yml @@ -12,6 +12,10 @@ on: concurrency: af +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_de.yml b/.github/workflows/translate_de.yml index c4fd60d92..9c9567cd1 100644 --- a/.github/workflows/translate_de.yml +++ b/.github/workflows/translate_de.yml @@ -12,6 +12,10 @@ on: concurrency: de +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_el.yml b/.github/workflows/translate_el.yml index 78b067ddd..db8ff97e0 100644 --- a/.github/workflows/translate_el.yml +++ b/.github/workflows/translate_el.yml @@ -1,4 +1,4 @@ -name: Translator to GR (Greek) +name: Translator to EL (Greek) on: push: @@ -12,6 +12,10 @@ on: concurrency: el +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_es.yml b/.github/workflows/translate_es.yml index 1a9e16445..1042e78af 100644 --- a/.github/workflows/translate_es.yml +++ b/.github/workflows/translate_es.yml @@ -12,6 +12,10 @@ on: concurrency: es +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_fr.yml b/.github/workflows/translate_fr.yml index f57609fc2..eb1fb5450 100644 --- a/.github/workflows/translate_fr.yml +++ b/.github/workflows/translate_fr.yml @@ -12,6 +12,10 @@ on: concurrency: fr +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_in.yml b/.github/workflows/translate_in.yml index 3729b7db1..333fc60cf 100644 --- a/.github/workflows/translate_in.yml +++ b/.github/workflows/translate_in.yml @@ -12,6 +12,10 @@ on: concurrency: in +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_it.yml b/.github/workflows/translate_it.yml index 420b59e38..104dcebef 100644 --- a/.github/workflows/translate_it.yml +++ b/.github/workflows/translate_it.yml @@ -12,6 +12,10 @@ on: concurrency: it +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_ja.yml b/.github/workflows/translate_ja.yml index dad72e718..e1a2b51e7 100644 --- a/.github/workflows/translate_ja.yml +++ b/.github/workflows/translate_ja.yml @@ -12,6 +12,10 @@ on: concurrency: ja +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_ko.yml b/.github/workflows/translate_ko.yml index 0244410f7..ac2aa2f47 100644 --- a/.github/workflows/translate_ko.yml +++ b/.github/workflows/translate_ko.yml @@ -1,4 +1,4 @@ -name: Translator to KR (Korean) +name: Translator to KO (Korean) on: push: @@ -12,6 +12,10 @@ on: concurrency: ko +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_pl.yml b/.github/workflows/translate_pl.yml index 673e07ded..d02e0eec1 100644 --- a/.github/workflows/translate_pl.yml +++ b/.github/workflows/translate_pl.yml @@ -12,6 +12,10 @@ on: concurrency: pl +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_pt.yml b/.github/workflows/translate_pt.yml index 05759e4a8..77238a795 100644 --- a/.github/workflows/translate_pt.yml +++ b/.github/workflows/translate_pt.yml @@ -12,6 +12,10 @@ on: concurrency: pt +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_sr.yml b/.github/workflows/translate_sr.yml index cae1c16da..70a218dd2 100644 --- a/.github/workflows/translate_sr.yml +++ b/.github/workflows/translate_sr.yml @@ -1,4 +1,4 @@ -name: Translator to RS (Serbian) +name: Translator to SR (Serbian) on: push: @@ -12,6 +12,10 @@ on: concurrency: sr +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_sw.yml b/.github/workflows/translate_sw.yml index 93e3cf5c1..9075f05b1 100644 --- a/.github/workflows/translate_sw.yml +++ b/.github/workflows/translate_sw.yml @@ -12,6 +12,10 @@ on: concurrency: sw +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_tr.yml b/.github/workflows/translate_tr.yml index ea096c004..e8e23b91a 100644 --- a/.github/workflows/translate_tr.yml +++ b/.github/workflows/translate_tr.yml @@ -12,6 +12,10 @@ on: concurrency: tr +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_ua.yml b/.github/workflows/translate_uk.yml similarity index 64% rename from .github/workflows/translate_ua.yml rename to .github/workflows/translate_uk.yml index ce61393d6..c3261a9b8 100644 --- a/.github/workflows/translate_ua.yml +++ b/.github/workflows/translate_uk.yml @@ -1,4 +1,4 @@ -name: Translator to UA (Ukranian) +name: Translator to UK (Ukranian) on: push: @@ -10,7 +10,11 @@ on: - '.github/**' workflow_dispatch: -concurrency: ua +concurrency: uk + +permissions: + id-token: write + contents: write jobs: run-translation: @@ -18,24 +22,42 @@ jobs: environment: prod env: LANGUAGE: Ukranian - BRANCH: ua + BRANCH: uk steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_zh.yml b/.github/workflows/translate_zh.yml index 5ed19d989..3873e948c 100644 --- a/.github/workflows/translate_zh.yml +++ b/.github/workflows/translate_zh.yml @@ -12,6 +12,10 @@ on: concurrency: zh +permissions: + id-token: write + contents: write + jobs: run-translation: runs-on: ubuntu-latest @@ -22,20 +26,38 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies + - name: Install python dependencies run: | python -m pip install --upgrade pip pip3 install openai tqdm tiktoken - + + # Install Rust and Cargo + - name: Install Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Install mdBook and Plugins + - name: Install mdBook and Plugins + run: | + cargo install mdbook + cargo install mdbook-alerts + cargo install mdbook-reading-time + cargo install mdbook-pagetoc + cargo install mdbook-tabs + cargo install mdbook-codename + + - name: Update & install wget & translator.py run: | sudo apt-get update @@ -73,9 +95,25 @@ jobs: echo "Translating $(cat /tmp/file_paths.txt)" python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 + # Push changes to the repository - name: Commit and push changes run: | git checkout "$BRANCH" git add -A git commit -m "Translated $BRANCH files" || true git push --set-upstream origin "$BRANCH" + + # Build the mdBook + - name: Build mdBook + run: mdbook build + + # 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: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file