-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workflow to check and optimize svgs (#445)
### Description <!-- Summary of change. Example: Add sepolia chain --> - Add workflow to trigger script to validate and optimize SVGs - Add script to validate SVG and then optimize - Added [SVGO library ](https://www.npmjs.com/package/svgo), which helps optimize SVGs PD: Many svgs were optimized, but it shouldn't trigger again since no changes will be needed (Tested with Max 20KBs but it should be 100 KBs) ![Screenshot 2024-12-23 at 7 48 03 AM](https://github.com/user-attachments/assets/8d3e2b4b-c863-49e1-82d4-893c58e99002) ### Backward compatibility Yes ### Testing CLI testing and testing in warp ui --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: xeno097 <[email protected]>
- Loading branch information
1 parent
207a4ff
commit 36b4c5f
Showing
256 changed files
with
613 additions
and
718 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@hyperlane-xyz/registry': minor | ||
--- | ||
|
||
Add workflow to validate and optimize SVGs, update SVGs with optimized version |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: optimize-svg | ||
|
||
on: | ||
pull_request: | ||
# Allows you to run this workflow manually | ||
workflow_dispatch: | ||
|
||
jobs: | ||
optimize: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref || 'main' }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
**/node_modules | ||
.yarn/cache | ||
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }} | ||
|
||
- name: yarn-install | ||
run: | | ||
yarn install | ||
CHANGES=$(git status -s) | ||
if [[ ! -z $CHANGES ]]; then | ||
echo "Changes found: $CHANGES" | ||
git diff | ||
exit 1 | ||
fi | ||
- name: setup-node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
- name: validate-optimize-svgs | ||
run: | | ||
node ./scripts/optimize-svg.js | ||
- name: configure-git | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: commit-changes | ||
run: | | ||
CHANGES=$(git status -s) | ||
if [[ ! -z $CHANGES ]]; then | ||
git add . | ||
git commit -m "Optimize SVG files" | ||
git push | ||
else | ||
echo "No changes to commit." | ||
fi |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.