Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Create analyze-manifest.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
livrasand authored Jun 23, 2024
1 parent 1ff6768 commit ba3612b
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/analyze-manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Analyze Manifests and Generate Key
on:
push:
branches:
- develop # 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

0 comments on commit ba3612b

Please sign in to comment.