update_foundation #532
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: 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: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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" --outputJson="../../Sources/CharcoalShared/Generated" --outputSwift="../../Sources/CharcoalShared/Generated" --outputColorAsset="../../Sources/CharcoalShared/ColorPalette.generated.xcassets" | |
rm theme.json | |
- name: Update icon | |
run: | | |
cd scripts/xcasset-gen | |
OUTPUT_ROOT_DIR=icons npx @charcoal-ui/icons-cli@latest figma:export --format pdf | |
npm install | |
npm run xcasset-gen generate -- --input icons/pdf --output ../../Sources/CharcoalShared/Images.xcassets | |
rm -rf icons | |
- name: Generate Swift file | |
run: | | |
swift run --package-path BuildTools swiftgen | |
git restore BuildTools/Package.resolved | |
- 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" |