Skip to content

🚀 Release (Figma) #475

🚀 Release (Figma)

🚀 Release (Figma) #475

Workflow file for this run

name: 🚀 Release (Figma)
on:
workflow_dispatch:
inputs:
brand:
type: choice
description: Library to export
required: true
default: "all"
options:
- all
- telefonica
- o2
- o2-new
- blau
- vivo
draft:
type: boolean
default: true
description: Draft PR
env:
TELEFONICA_FIGMA_ID: JHuzksh01yxExMeMQBvymq
O2_FIGMA_ID: wHTqJ7KDhGKrNSNpmMb9nW
O2_NEW_FIGMA_ID: M9q1Iu9zuoQtoIktd915gj
BLAU_FIGMA_ID: 6TYIfq6EZJl7NcSbbYAo79
VIVO_FIGMA_ID: IrcHGIgsF5Cq4ZX1LRhuis
MISTICA_ICONS_FILE_URL: https://www.figma.com/file/JHuzksh01yxExMeMQBvymq/M%C3%ADstica-Icons?node-id=0%3A71&t=hqGKHvCEvRHET7YC-0
O2_FILE_URL: https://www.figma.com/file/wHTqJ7KDhGKrNSNpmMb9nW/?node-id=611%3A3298
O2_NEW_FILE_URL: https://www.figma.com/design/M9q1Iu9zuoQtoIktd915gj/O2-New?node-id=3962-2&t=ute0n3XeLMeJ2cUO-0
BLAU_FILE_URL: https://www.figma.com/file/6TYIfq6EZJl7NcSbbYAo79/Blau?node-id=0%3A1
VIVO_FILE_URL: https://www.figma.com/file/IrcHGIgsF5Cq4ZX1LRhuis/Vivo-New-(Beta)?type=design&node-id=2625-199
jobs:
export-icons:
runs-on: ubuntu-latest
strategy:
matrix:
brand: [all, telefonica, o2, o2-new, blau, vivo]
if: ${{ matrix.brand == github.event.inputs.brand || github.event.inputs.brand == 'all' }}

Check failure on line 41 in .github/workflows/figma-export.yml

View workflow run for this annotation

GitHub Actions / 🚀 Release (Figma)

Invalid workflow file

The workflow is not valid. .github/workflows/figma-export.yml (Line: 41, Col: 9): Unrecognized named-value: 'matrix'. Located at position 1 within expression: matrix.brand == github.event.inputs.brand || github.event.inputs.brand == 'all'
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
npm install figma-export-icons --save
sudo apt-get install -y librsvg2-bin libimage-exiftool-perl qpdf
- name: Checkout branch or create new one
run: |
git fetch
if git branch -a | grep origin/import-figma-icons; then
git checkout import-figma-icons
else
git checkout -b import-figma-icons
fi
- name: Generate icon config
run: |
case ${{ matrix.brand }} in
telefonica)
figma_ids=("${{ env.TELEFONICA_FIGMA_ID }}")
frames=("Filled" "Regular" "Light")
paths=("telefonica/filled" "telefonica/regular" "telefonica/light")
;;
o2)
figma_ids=("${{ env.O2_FIGMA_ID }}")
frames=("Filled" "Regular" "Light")
paths=("o2/filled" "o2/regular" "o2/light")
;;
o2-new)
figma_ids=("${{ env.O2_NEW_FIGMA_ID }}")
frames=("Filled" "Regular" "Light")
paths=("o2-new/filled" "o2-new/regular" "o2-new/light")
;;
blau)
figma_ids=("${{ env.BLAU_FIGMA_ID }}")
frames=("Filled" "Regular")
paths=("blau/filled" "blau/regular")
;;
vivo)
figma_ids=("${{ env.VIVO_FIGMA_ID }}")
frames=("Filled" "Regular" "Light")
paths=("vivo-new/filled" "vivo-new/regular" "vivo-new/light")
;;
all)
figma_ids=("${{ env.TELEFONICA_FIGMA_ID }}" "${{ env.O2_FIGMA_ID }}" "${{ env.O2_NEW_FIGMA_ID }}" "${{ env.BLAU_FIGMA_ID }}" "${{ env.VIVO_FIGMA_ID }}")
frames=("Filled" "Regular" "Light")
paths=("telefonica/filled" "telefonica/regular" "telefonica/light" "o2/filled" "o2/regular" "o2/light" "o2-new/filled" "o2-new/regular" "o2-new/light" "blau/filled" "blau/regular" "vivo-new/filled" "vivo-new/regular" "vivo-new/light")
;;
esac
for i in ${!figma_ids[@]}; do
for j in ${!frames[@]}; do
sed -e "s/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/" -e "s/FILE_ID/${figma_ids[i]}/" -e "s/ICON_FRAME/${frames[j]}/" -e "s|ICON_PATH|icons/${paths[j]}|g" figma-export-icons.template.json > ${paths[j]}.json
done
done
- name: Export icons
run: |
for i in ${!figma_ids[@]}; do
for j in ${!frames[@]}; do
npm run export-${paths[j]//\//-}
done
done
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons -r -o icons
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons -type f -name "*.pdf"); do echo $i && exiftool -overwrite_original_in_place -all:all= $i > /dev/null 2>&1 && qpdf --replace-input --deterministic-id $i; done # remove PDF metadata
- name: Readme generator
run: sudo python3 .github/md-generator/generate_markdown.py icons
- name: Commit & Push
env:
GITHUB_TOKEN: ${{ secrets.NOVUM_PRIVATE_REPOS }}
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Figma icons updated"
git push origin import-figma-icons
- name: Create Pull-Request
uses: repo-sync/pull-request@v2
with:
source_branch: import-figma-icons
destination_branch: "production"
pr_title: "Update ${{ matrix.brand }} icons"
pr_body: |
New version of icons exported from [Mistica Icons](${{ env.MISTICA_ICONS_FILE_URL }}), [O2](${{ env.O2_FILE_URL }}), [O2-new](${{ env.O2_NEW_FILE_URL }}), [Blau](${{ env.BLAU_FILE_URL }}), and [Vivo](${{ env.VIVO_FILE_URL }}).
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.NOVUM_PRIVATE_REPOS }}