This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from livrasand/develop
Create analyze-manifest.yml
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
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
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 |