Skip to content

🚀 Release (Figma) #428

🚀 Release (Figma)

🚀 Release (Figma) #428

Workflow file for this run

name: 🚀 Release (Figma)
# push:
# paths:
# - ".github/workflows/figma-export.yml"
on:
workflow_dispatch:
inputs:
brand:
type: choice
description: Library to export
required: true
default: "all"
options:
- all
- telefonica
- o2
- blau
- vivo
draft:
type: boolean
default: true
description: Draft PR
env:
TELEFONICA_FIGMA_ID: JHuzksh01yxExMeMQBvymq
O2_FIGMA_ID: wHTqJ7KDhGKrNSNpmMb9nW
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
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-all:
if: ${{ github.event.inputs.brand == 'all' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- 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: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/telefonica/filled|g' figma-export-icons.template.json > telefonica-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/telefonica/regular|g' figma-export-icons.template.json > telefonica-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/telefonica/light|g' figma-export-icons.template.json > telefonica-light.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/o2/filled|g' figma-export-icons.template.json > o2-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/o2/regular|g' figma-export-icons.template.json > o2-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/o2/light|g' figma-export-icons.template.json > o2-light.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.BLAU_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/blau/regular|g' figma-export-icons.template.json > blau-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.BLAU_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/blau/filled|g' figma-export-icons.template.json > blau-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/vivo-new/filled|g' figma-export-icons.template.json > vivo-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/vivo-new/regular|g' figma-export-icons.template.json > vivo-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/vivo-new/light|g' figma-export-icons.template.json > vivo-light.json
- name: Export icons
run: |
npm run export-telefonica-filled
npm run export-telefonica-regular
npm run export-telefonica-light
npm run export-o2-filled
npm run export-o2-regular
npm run export-o2-light
npm run export-blau-regular
npm run export-blau-filled
npm run export-vivo-filled
npm run export-vivo-regular
npm run export-vivo-light
- 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/md-generator.py icons
- name: Commit & Push
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 Figma icons"
pr_body: "
New version of icons exported from [Mistica Icons](${{env.MISTICA_ICONS_FILE_URL}}), [O2](${{env.O2_FILE_URL}}), [Blau](${{env.BLAU_FILE_URL}}) & [Vivo](${{env.VIVO_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
export-telefonica:
if: ${{ github.event.inputs.brand == 'telefonica' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- 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: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/telefonica/filled|g' figma-export-icons.template.json > telefonica-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/telefonica/regular|g' figma-export-icons.template.json > telefonica-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/telefonica/light|g' figma-export-icons.template.json > telefonica-light.json
- name: Export icons
run: |
npm run export-telefonica-filled
npm run export-telefonica-regular
npm run export-telefonica-light
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons/telefonica -r -o icons/telefonica
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons/telefonica -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons/telefonica -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/md-generator.py icons
- name: Commit & Push
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 Mística icons"
pr_body: "
New version of icons exported from [Mistica Icons](${{env.MISTICA_ICONS_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
export-o2:
if: ${{ github.event.inputs.brand == 'o2' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- 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: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/o2/filled|g' figma-export-icons.template.json > o2-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/o2/regular|g' figma-export-icons.template.json > o2-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/o2/light|g' figma-export-icons.template.json > o2-light.json
- name: Export icons
run: |
npm run export-o2-filled
npm run export-o2-regular
npm run export-o2-light
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons/o2 -r -o icons/o2
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons/o2 -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons/o2 -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/md-generator.py icons
- name: Commit & Push
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 O2 icons"
pr_body: "
New version of icons exported from [O2](${{env.O2_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
export-blau:
if: ${{ github.event.inputs.brand == 'blau' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- 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: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.BLAU_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/blau/regular|g' figma-export-icons.template.json > blau-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.BLAU_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/blau/filled|g' figma-export-icons.template.json > blau-filled.json
- name: Export icons
run: |
npm run export-blau-regular
npm run export-blau-filled
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons/blau -r -o icons/blau
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons/blau -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons/blau -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/md-generator.py icons
- name: Commit & Push
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 Blau icons"
pr_body: "
New version of icons exported from [Blau](${{env.BLAU_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
export-vivo:
if: ${{ github.event.inputs.brand == 'vivo' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- 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: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/vivo-new/filled|g' figma-export-icons.template.json > vivo-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/vivo-new/regular|g' figma-export-icons.template.json > vivo-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/vivo-new/light|g' figma-export-icons.template.json > vivo-light.json
- name: Export icons
run: |
npm run export-vivo-filled
npm run export-vivo-regular
npm run export-vivo-light
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons/vivo-new -r -o icons/vivo-new
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons/vivo-new -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons/vivo-new -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/md-generator.py icons
- name: Commit & Push
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 Vivo icons"
pr_body: "
New version of icons exported from [Vivo](${{env.VIVO_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# pr_body: "
# New version of icons exported from [Mistica Icons][mistica-icons] & [O2][o2-icons] n\
# - [ ] [Review readme import-figma-icons][readme] n\
# [mistica-icons]: https://www.figma.com/file/${{env.TELEFONICA_FIGMA_ID}}/Mistica'-Icons?node-id=0%3A71 n\
# [o2-icons]: https://www.figma.com/file/${{env.O2_FIGMA_ID}}/?node-id=611%3A3298 n\
# [readme]: https://github.com/Telefonica/mistica-icons/tree/import-figma-icons"