@@ -36,53 +36,61 @@ jobs:
3636 echo "${{ steps.get-latest-commit.outputs.latest_commit }}" > last_commit
3737
3838 build :
39- name : Build pdf.js & extract types
39+ name : Build pdf.js & upload types
4040 needs : check
4141 if : ${{ needs.check.outputs.need_build == 'true' }}
4242 runs-on : ubuntu-latest
43- permissions :
44- contents : write
4543
4644 steps :
47- - uses : actions/checkout@v4
45+ - name : Checkout Zotero/pdf.js
46+ uses : actions/checkout@v5
4847 with :
49- fetch-depth : 0
50-
51- - name : Clone Zotero/pdf.js
52- run : git clone https://github.com/zotero/pdf.js.git pdfjs
48+ repository : zotero/pdf.js
5349
54- - uses : actions/setup-node@v4
50+ - name : Setup Node.js
51+ uses : actions/setup-node@v5
5552 with :
56- node-version : 20
53+ node-version : latest
5754 cache : npm
58- cache-dependency-path : pdfjs/package-lock.json
5955
6056 - name : Install dependencies
6157 run : npm install
62- working-directory : pdfjs
6358
6459 - name : Build pdf.js (gulp dist)
6560 run : npx gulp dist
66- working-directory : pdfjs
6761
68- - name : Copy types to repo
69- run : |
70- rm -rf types
71- mkdir -p types
72- cp -r pdfjs/ build/types/. types/
73- # echo "${{ needs.check.outputs.commit_hash }}" > pdfjs-commit.txt
62+ - name : Upload types artifact
63+ uses : actions/upload-artifact@v4
64+ with :
65+ name : pdfjs- types
66+ path : build/types
67+ if-no-files-found : error
7468
75- - name : Commit and push updated types
76- run : |
77- git config user.name "github-actions[bot]"
78- git config user.email "github-actions[bot]@users.noreply.github.com"
79- git add types
80- if git diff --cached --quiet; then
81- echo "✅ No changes to commit."
82- else
83- git commit -m "feat: update pdf.js types to commit ${{ needs.check.outputs.commit_hash }}"
84- git push
85- fi
69+ commit :
70+ name : Commit updated types
71+ needs : [check, build]
72+ if : ${{ needs.check.outputs.need_build == 'true' }}
73+ runs-on : ubuntu-latest
74+ permissions :
75+ contents : write
76+
77+ steps :
78+ - name : Checkout zotero-pdfjs-types repo
79+ uses : actions/checkout@v5
80+
81+ - name : Download built types
82+ uses : actions/download-artifact@v4
83+ with :
84+ name : pdfjs-types
85+ path : types
86+
87+ - name : Commit and push changes
88+ uses : EndBug/add-and-commit@v9
89+ with :
90+ author_name : github-actions[bot]
91+ author_email : github-actions[bot]@users.noreply.github.com
92+ message : " feat: update pdf.js types to commit ${{ needs.check.outputs.commit_hash }}"
93+ add : " types"
8694
8795 # publish:
8896 # name: Publish to npm
@@ -96,18 +104,11 @@ jobs:
96104 # steps:
97105 # - uses: actions/checkout@v4
98106
99- # - uses: pnpm/action-setup@v3
100- # with:
101- # version: 9
102-
103107 # - uses: actions/setup-node@v4
104108 # with:
105109 # node-version: 20
106110 # registry-url: "https://registry.npmjs.org/"
107111
108- # - name: Install deps
109- # run: pnpm install
110-
111112 # - name: Bump patch version
112113 # run: |
113114 # current_version=$(node -p "require('./package.json').version")
0 commit comments