This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
Update analyze-manifest.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Analyze Manifests and Generate Key | |
on: | |
push: | |
branches: | |
- main # Cambia esto según tu rama principal | |
jobs: | |
analyze_manifests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' # Elige la versión de Python adecuada | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyjq # Instala pyjq para procesamiento de JSON en Python | |
- name: Analyze manifests and generate key | |
run: | | |
# Listar los directorios dentro de examples-wts | |
LANGUAGES=$(ls examples-wts) | |
for LANG in $LANGUAGES; do | |
# Iterar sobre los manifest.json dentro de cada directorio de idioma | |
PROJECTS=$(find examples-wts/$LANG -name "manifest.json") | |
for MANIFEST_FILE in $PROJECTS; do | |
# Extraer symbol, year y language | |
SYMBOL=$(pyjq -r '.publication.symbol' "$MANIFEST_FILE") | |
YEAR=$(pyjq -r '.publication.year' "$MANIFEST_FILE") | |
LANGUAGE=$(pyjq -r '.publication.language' "$MANIFEST_FILE") | |
# Construir la clave en el formato language_symbol_year | |
KEY="${LANGUAGE}_${SYMBOL}_${YEAR}" | |
# Aplicar la transformación especificada para obtener la clave cifrada | |
ENCRYPTED_KEY=$(echo -n "$KEY" | openssl dgst -sha256 -hex | cut -d' ' -f2) | |
ENCRYPTED_KEY=$(echo -n "$ENCRYPTED_KEY" | xxd -r -p | openssl dgst -sha256 -hex) | |
# Guardar el resultado | |
echo "$ENCRYPTED_KEY" > "encrypted_key_${LANGUAGE}_${SYMBOL}_${YEAR}.txt" | |
done | |
done | |
- name: Upload encrypted keys as artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: encrypted-keys | |
path: encrypted_key_*.txt |