diff --git a/.github/workflows/icons.yml b/.github/workflows/icons.yml new file mode 100644 index 0000000..48c0e4f --- /dev/null +++ b/.github/workflows/icons.yml @@ -0,0 +1,64 @@ +name: Add svg Icons + +on: + pull_request: + branches: + - 'main' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: ${{ steps.detect-package-manager.outputs.manager }} + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + projects/filigran-website/.next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- + - name: Install dependencies + run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + - name: Install svgr/cli + run: yarn global add @svgr/cli + - name: Install rimraf and tsup + run: yarn global add rimraf tsup + - name: Run extract-icons + run: cd packages/filigran-icon && yarn extract-icons + env: + FIGMA_FILE_ID: ${{ secrets.FIGMA_FILE_ID_ICONS }} + FIGMA_API_TOKEN: ${{ secrets.FIGMA_API_TOKEN }} + + - name: Run svgr + run: cd packages/filigran-icon && yarn svgr + + - name: Run build + run: cd packages/filigran-icon && yarn build + - name: Commit changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git checkout -b update-icons-branch + git add . + git commit -m "Update icons and build artifacts" + git push origin update-icons-branch + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.TOKEN_GITHUB }} + branch: update-icons-branch + title: "Update icons and build artifacts" + body: "This PR was automatically created by GitHub Actions after building the icons." + base: main diff --git a/projects/filigran-website/components/display-all-icons.tsx b/projects/filigran-website/components/display-all-icons.tsx index e7e9e95..638de39 100644 --- a/projects/filigran-website/components/display-all-icons.tsx +++ b/projects/filigran-website/components/display-all-icons.tsx @@ -65,7 +65,9 @@ export const DisplayAllIcons = () => {
+ {'<'} {icon} + {' className="h-4 w-4"/>'}
{' '}