File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 - " main"
77
88jobs :
9- svgr-sync :
10- name : Regenerate icon components
11- runs-on : ubuntu-latest
12- permissions :
13- contents : write
14- outputs :
15- pushed : ${{ steps.sync.outputs.pushed }}
16- steps :
17- - uses : actions/checkout@v4
18- with :
19- token : ${{ secrets.GITHUB_TOKEN }}
20-
21- - uses : pnpm/action-setup@v4
22- with :
23- version : 9
24-
25- - uses : actions/setup-node@v4
26- with :
27- node-version : " 20"
28- cache : " pnpm"
29-
30- - name : Install dependencies
31- run : pnpm install --frozen-lockfile
32-
33- - name : Generate icon components from SVGs
34- run : pnpm run svgr
35-
36- - name : Commit and push if out of sync
37- id : sync
38- run : |
39- if git diff --exit-code src; then
40- echo "pushed=false" >> "$GITHUB_OUTPUT"
41- echo "Generated components already in sync."
42- exit 0
43- fi
44- git config user.name "github-actions[bot]"
45- git config user.email "github-actions[bot]@users.noreply.github.com"
46- git add src
47- git commit -m "chore: regenerate icon components from SVGs"
48- git push
49- echo "pushed=true" >> "$GITHUB_OUTPUT"
50- echo "Regenerated src/ and pushed to main. Release will run on the next workflow trigger."
51-
529 release :
53- needs : svgr-sync
54- if : needs.svgr-sync.outputs.pushed != 'true'
5510 uses : signoz/primus.workflows/.github/workflows/js-release.yaml@js-release
5611 secrets : inherit
5712 with :
Original file line number Diff line number Diff line change 88 - " svgr-template.js"
99 - " index-template.cjs"
1010 - " package.json"
11- push :
12- branches : ["main"]
13- paths :
14- - " assets/**"
15- - " svgr-template.js"
16- - " index-template.cjs"
17- - " package.json"
1811
1912jobs :
20- svgr-sync :
21- name : SVGR – regenerate or verify
13+ svgr-check :
14+ name : SVGR in sync
2215 runs-on : ubuntu-latest
23- permissions :
24- contents : write
2516 steps :
2617 - uses : actions/checkout@v4
27- with :
28- token : ${{ secrets.GITHUB_TOKEN }}
2918
3019 - uses : pnpm/action-setup@v4
3120 with :
@@ -42,24 +31,14 @@ jobs:
4231 - name : Generate icon components from SVGs
4332 run : pnpm run svgr
4433
45- - name : Sync generated components
34+ - name : Check components in sync with assets
4635 run : |
47- if git diff --exit-code src; then
48- echo "Generated components are in sync."
49- exit 0
50- fi
51- # On PRs: commit and push so the branch stays in sync
52- if [ "${{ github.event_name }}" = "pull_request" ]; then
53- git config user.name "github-actions[bot]"
54- git config user.email "github-actions[bot]@users.noreply.github.com"
55- git add src
56- git commit -m "chore: regenerate icon components from SVGs [skip ci]"
57- git push
58- echo "Regenerated src/ and pushed to the branch."
59- else
60- # Push to main: require author to have run svgr (do not auto-commit to main)
61- echo "::error::Generated icon components are out of sync with assets/*.svg"
62- echo "Run \`pnpm run svgr\` and commit the updated src/ (or merge a PR where CI already did it)."
36+ if ! git diff --exit-code src; then
37+ echo "::error::Generated icon components are out of sync with assets."
38+ echo ""
39+ echo "Run the following locally, then commit and push:"
40+ echo " pnpm run svgr"
41+ echo ""
6342 git diff --stat src
6443 exit 1
6544 fi
You can’t perform that action at this time.
0 commit comments