Skip to content

update_foundation

update_foundation #244

name: update_foundation
on:
schedule:
- cron: '0 11 * * 1-5'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
FIGMA_FILE_URL: ${{secrets.FIGMA_FILE_URL}}
FIGMA_TOKEN: ${{secrets.FIGMA_TOKEN}}
GITHUB_ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up node using nvm
uses: dcodeIO/setup-node-nvm@master
with:
node-version: lts/*
- name: Update foundation
run: |
cd scripts/foundation-gen/
curl -L https://unpkg.com/@charcoal-ui/theme@latest/theme.json -o theme.json
npm install
npm run foundation-gen generate -- --input="theme.json" --output="../../charcoal-android/src/main/res/values" --outputJson="../../charcoal-android-compose/assets/generated/" --outputKotlin="../../charcoal-android-compose/src/main/java/net/pixiv/charcoal/android/compose/generated"
rm theme.json
- name: Update icon
run: |
OUTPUT_ROOT_DIR=icons npx @charcoal-ui/icons-cli@latest figma:export --format svg
cd icons/svg/32
ls | sed -e s/\.svg// | awk '{print $1 ".svg " "ic_charcoal_" tolower($1) "_32.svg"}' | xargs -n 2 mv
cd -
cd icons/svg/24
ls | sed -e s/\.svg// | awk '{print $1 ".svg " "ic_charcoal_" tolower($1) "_24.svg"}' | xargs -n 2 mv
cd -
cd icons/svg/16
ls | sed -e s/\.svg// | awk '{print $1 ".svg " "ic_charcoal_" tolower($1) "_16.svg"}' | xargs -n 2 mv
cd -
cd icons/svg/Inline
ls | sed -e s/\.svg// | awk '{print $1 ".svg " "ic_charcoal_" tolower($1) "_inline.svg"}' | xargs -n 2 mv
cd -
npx vd-tool -c -in icons/svg/32 -out charcoal-android/src/main/res/drawable/
npx vd-tool -c -in icons/svg/24 -out charcoal-android/src/main/res/drawable/
npx vd-tool -c -in icons/svg/16 -out charcoal-android/src/main/res/drawable/
npx vd-tool -c -in icons/svg/Inline -out charcoal-android/src/main/res/drawable/
rm -rf icons
- name: Create Pull Request
run: |
cd scripts/create-pull-request/
npm install
npm run create-pull-request -- --owner="${{github.repository_owner}}" --repo="${GITHUB_REPOSITORY#*/}" --baseBranch="main"