|
1 | | -name: ci |
| 1 | +name: ci/publish |
2 | 2 | on: |
3 | 3 | push: |
4 | 4 | paths: |
|
11 | 11 | pull_request: |
12 | 12 | branches: [master] |
13 | 13 |
|
| 14 | + workflow_dispatch: |
| 15 | + inputs: |
| 16 | + tag: |
| 17 | + description: Tag to publish e.g. v2.4.1 (beta), v2.5.0 (stable if ends with ".0") |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + |
14 | 21 | jobs: |
15 | | - test: |
| 22 | + build: |
16 | 23 | runs-on: ubuntu-latest |
17 | | - |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + build: [chrome-mv3, firefox, mv2] |
18 | 27 | steps: |
19 | 28 | - uses: actions/checkout@v6 |
| 29 | + with: |
| 30 | + ref: ${{github.event.inputs.tag}} |
20 | 31 | - uses: pnpm/action-setup@v4 |
21 | 32 | with: |
22 | 33 | version: 10 |
23 | 34 | - uses: actions/setup-node@v6 |
24 | 35 | with: |
25 | 36 | node-version-file: 'package.json' |
| 37 | + cache: 'pnpm' |
26 | 38 |
|
27 | 39 | - run: pnpm install --ignore-scripts # ignore postinstall hook |
28 | 40 | - run: pnpm test |
29 | | - |
| 41 | + if: ${{matrix.build == 'chrome-mv3'}} |
30 | 42 | - run: echo "_REV=$(git rev-parse --short HEAD)" >> $GITHUB_ENV |
31 | 43 |
|
32 | | - # MV3 chrome |
| 44 | + - run: pnpm build-${{matrix.build}} |
33 | 45 |
|
34 | | - - run: rm -rf dist && pnpm build-chrome-mv3 |
35 | | - - uses: actions/upload-artifact@v4 |
| 46 | + - name: upload "${{matrix.build}}" to github |
| 47 | + uses: actions/upload-artifact@v4 |
36 | 48 | with: |
37 | | - name: 'stylus-chrome-mv3-${{ env._VER }}-${{ env._REV }}' |
| 49 | + name: 'stylus-${{matrix.build}}-${{env._VER}}-${{env._REV}}' |
38 | 50 | path: 'dist/*' |
39 | 51 | if-no-files-found: error |
40 | 52 |
|
41 | | - # MV2 firefox |
42 | | - |
43 | | - - run: rm -rf dist && pnpm build-firefox |
44 | | - - uses: actions/upload-artifact@v4 |
45 | | - with: |
46 | | - name: 'stylus-firefox-mv2-${{ env._VER }}-${{ env._REV }}' |
47 | | - path: 'dist/*' |
48 | | - if-no-files-found: error |
49 | | - |
50 | | - # MV2 |
51 | | - |
52 | | - - run: rm -rf dist && pnpm build-mv2 |
53 | | - - uses: actions/upload-artifact@v4 |
54 | | - with: |
55 | | - name: 'stylus-mv2-${{ env._VER }}-${{ env._REV }}' |
56 | | - path: 'dist/*' |
57 | | - if-no-files-found: error |
| 53 | + - name: publish "chrome-mv3" to CWS |
| 54 | + if: ${{matrix.build == 'chrome-mv3' && github.event_name == 'workflow_dispatch'}} |
| 55 | + continue-on-error: true |
| 56 | + working-directory: |
| 57 | + dist |
| 58 | + env: |
| 59 | + CLIENT_ID: ${{secrets.CLIENT_ID}} |
| 60 | + CLIENT_SECRET: ${{secrets.CLIENT_SECRET}} |
| 61 | + REFRESH_TOKEN: ${{secrets.REFRESH_TOKEN}} |
| 62 | + run: | |
| 63 | + node ../tools/define-extension-id.js |
| 64 | + npx chrome-webstore-upload-cli@3 |
0 commit comments