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
55 lines (45 loc) · 1.85 KB
/
analyze-manifest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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