cambio de nombre en carpeta, autmaticación del json #160
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: build-icons-cd | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: 🛎 Check out master | |
uses: actions/checkout@v4.1.5 | |
with: | |
fetch-depth: 1 | |
path: ./iconos | |
- name: 🎩 Instalamos dependencias | |
working-directory: /tmp | |
run: | | |
echo "Configuramos la versión necesaria de Ruby (3.1.x)." | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
exec $SHELL | |
sudo apt remove ruby-build | |
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build | |
git -C "$(rbenv root)"/plugins/ruby-build pull | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
exec $SHELL | |
rbenv install 3.1.6 | |
rbenv global 3.1.6 | |
echo "Instalamos mas dependencias." | |
sudo apt install libjpeg-dev libtiff5-dev libpng-dev libfreetype6-dev libgif-dev libgtk-3-dev libxml2-dev libpango1.0-dev libcairo2-dev libspiro-dev python3-dev ninja-build cmake build-essential gettext | |
sudo apt install zlib1g-dev | |
git clone https://github.com/fontforge/fontforge.git fontforge && cd fontforge && mkdir build && cd build && sudo cmake -GNinja .. && sudo ninja && sudo ninja install | |
cd ../../ | |
git clone https://github.com/bramstein/sfnt2woff-zopfli.git sfnt2woff-zopfli && cd sfnt2woff-zopfli && make && mv sfnt2woff-zopfli /usr/local/bin/sfnt2woff | |
git clone --recursive https://github.com/google/woff2.git && cd woff2 && make clean all && sudo mv woff2_compress /usr/local/bin/ && sudo mv woff2_decompress /usr/local/bin/ | |
sudo apt install jq | |
- name: 🎩 Instalamos Fontcustom | |
working-directory: ./iconos | |
run: | | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
exec $SHELL | |
rbenv global 3.1.6 | |
sudo gem install bundler fontcustom | |
sudo bundle install | |
- name: 🧹 Clean site | |
run: | | |
if [ -d "docs" ]; then | |
rm -rf docs/* | |
fi | |
- name: 🎩 Compilamos los íconos | |
working-directory: ./iconos | |
run: | | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
exec $SHELL | |
rbenv global 3.1.6 | |
sudo gem install bundler | |
bundle exec fontcustom compile -F | |
- name: 🔨 Instalamos dependencias para la documentación | |
working-directory: ./iconos | |
run: | | |
cp favicon.ico ./docs/. | |
mkdir -p dist/ilustraciones | |
cp -r src/_ilus/* dist/ilustraciones/. | |
- name: Descargamos la metadata y generamos el JSON | |
working-directory: ./docs | |
run: | | |
echo 'Descargamos de Google Sheets el JSON con la metadata' | |
wget -O ilus-google.json https://sheets.googleapis.com/v4/spreadsheets/13CLjNqMQlUXj849XYL_nGDaAkE90OOFT3mXL-Iag9xM/values/ilustraciones?alt=json&key=AIzaSyC4jEmhDrBl3bgEi6VEO4Ek5fl7vfHrQcQ | |
cat ilus-google.json | jq -r '.values as $vals |[ $vals[0] as $keys | $vals[1:][] | [ $keys, . ] | transpose | map({ (.[0]): .[1] }) | add ]' > ilus-arg.json | |
rm ilus-google.json | |
- name: 🧪 Deploy build | |
working-directory: ./iconos | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add . | |
git commit -am "🧪 Deploy with ${GITHUB_WORKFLOW}" | |
git push --all -f https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git | |
- name: Checkout Poncho | |
uses: actions/checkout@v4.1.5 | |
with: | |
repository: argob/poncho | |
ref: 'release-1.x' | |
path: ./poncho | |
- name: Copiamos archivos generados en el otro repo | |
run: | | |
echo "Copying..." | |
cp -R ./iconos/dist/css/icono-arg.css ./poncho/dist/css/ | |
cp -R ./iconos/docs/icono-arg.json ./poncho/dist/jsons/icono-arg.json | |
- name: 🧪 Push Iconos Arg. | |
working-directory: ./poncho | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add . | |
git commit -am "🧪 Deploy iconos-arg with ${GITHUB_WORKFLOW}" | |
git push --all -f https://${{ secrets.GITHUB_TOKEN }}@github.com/argob/poncho.git | |
# - name: Push Project B | |
# run: | | |
# cd ./poncho | |
# git add . | |
# git config user.name "${GITHUB_ACTOR}" | |
# git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
# git commit -am "File Replicated from Iconos" | |
# git push |