File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : Run tests
1+ name : run tests
22on :
3- push :
4- branches :
5- - main
63 pull_request :
74 branches :
85 - main
@@ -18,13 +15,14 @@ jobs:
1815 - name : Use Node.js
1916 uses : actions/setup-node@v7 # v4は2024年ごろの主流
2017 with :
21- node-version : ' 24'
18+ node-version : ' 24'
19+ cache : ' npm'
2220
23- - name : create ci environment
21+ - name : Install dependencies # continuous intengrationではなくclean install
2422 run : npm ci
2523
2624 - name : build package
2725 run : npm run build
2826
2927 - name : run tests
30- run : npm test
28+ run : npm test
Original file line number Diff line number Diff line change 1+ name : release
2+ on :
3+ push :
4+ branches :
5+ - main
6+ paths :
7+ - packages/browser/manifest.json
8+
9+ jobs :
10+ release :
11+ runs-on : ubuntu-latest # 通常はubuntu-latestにすることが多い、ubuntuはLinuxを用いたOSの一つで、ci/cd時にもよく使われる
12+
13+ steps :
14+ - name : checkout repository
15+ uses : actions/checkout@v4 # v3だと古い
16+
17+ - name : Use Node.js
18+ uses : actions/setup-node@v7 # v4は2024年ごろの主流
19+ with :
20+ node-version : ' 24'
21+ cache : ' npm'
22+
23+ - name : Install dependencies # continuous intengrationではなくclean install
24+ run : npm ci
25+
26+ - name : build package
27+ run : npm run build
28+
29+ - name : run tests
30+ run : npm test
31+
32+ - name : compress dist folder
33+ run : node compress.js
34+
35+ - name : Submit
36+ run : |
37+ npx chrome-webstore-upload-cli@4 upload --source extension.zip --auto-publish
38+ env :
39+ EXTENSION_ID : ${{ secrets.EXTENSION_ID }}
40+ CLIENT_ID : ${{ secrets.CLIENT_ID }}
41+ CLIENT_SECRET : ${{ secrets.CLIENT_SECRET }}
42+ REFRESH_TOKEN : ${{ secrets.REFRESH_TOKEN }}
Original file line number Diff line number Diff line change 1+ const fs = require ( "node:fs" ) ;
2+ const path = require ( "node:path" ) ;
3+ const { ZipArchive } = require ( "archiver" ) ;
4+
5+ const sourceDir = path . join ( __dirname , "packages/browser/dist" ) ;
6+ const outputPath = path . join ( __dirname , "extension.zip" ) ;
7+
8+ const output = fs . createWriteStream ( outputPath ) ;
9+ const archive = new ZipArchive ( { zlib : { level : 9 } } ) ;
10+
11+ output . on ( "close" , ( ) => {
12+ console . log ( `Created extension.zip (${ archive . pointer ( ) } bytes)` ) ;
13+ } ) ;
14+
15+ archive . on ( "error" , ( error ) => {
16+ throw error ;
17+ } ) ;
18+
19+ archive . on ( "warning" , ( error ) => {
20+ throw error ;
21+ } ) ;
22+
23+ archive . pipe ( output ) ;
24+ archive . directory ( sourceDir , false ) ;
25+
26+ archive . finalize ( ) ;
You can’t perform that action at this time.
0 commit comments