|
9 | 9 | runs-on: ubuntu-latest |
10 | 10 | strategy: |
11 | 11 | matrix: |
12 | | - container: |
13 | | - [ |
14 | | - 'chrome', |
15 | | - 'firefox', |
16 | | - ] |
| 12 | + container: ['chrome', 'firefox'] |
17 | 13 | env: |
18 | 14 | BROWSER: ${{ matrix.container }} |
19 | 15 | VERSION: ${{ github.event.release.tag_name }} |
20 | 16 | steps: |
21 | | - - uses: actions/checkout@v4 |
22 | | - |
23 | | - - name: Setup pnpm |
24 | | - uses: pnpm/action-setup@v4 |
25 | | - with: |
26 | | - version: 9.14.4 |
27 | | - |
28 | | - - name: Use Node.js |
29 | | - uses: actions/setup-node@v4 |
30 | | - with: |
31 | | - node-version: '22.x' |
32 | | - cache: 'pnpm' |
33 | | - |
34 | | - - name: Install dependencies |
35 | | - run: pnpm install --frozen-lockfile |
36 | | - |
37 | | - - name: TypeScript type check |
38 | | - run: pnpm run typecheck |
39 | | - |
40 | | - - name: Set version number in manifest |
41 | | - run: | |
42 | | - VERSION_NUMBER=$(echo ${VERSION} | sed 's/^v//') |
43 | | - sed -i 's/"version": *"[0-9.]*"/"version": "'$VERSION_NUMBER'"/' manifest.json |
44 | | - |
45 | | - - name: Build Chrome |
46 | | - if: ${{ matrix.container == 'chrome' }} |
47 | | - run: pnpm run build |
48 | | - |
49 | | - - name: Build Firefox |
50 | | - if: ${{ matrix.container == 'firefox' }} |
51 | | - run: | |
52 | | - sed -i 's,"service_worker": "dist/background.js","scripts": ["dist/background.js"],g' ./manifest.json |
53 | | - pnpm run build |
54 | | - |
55 | | - - name: Package extension |
56 | | - run: | |
57 | | - PACKAGE_NAME="BandcampEnhancementSuite_${BROWSER}-$VERSION.zip" |
58 | | - zip $PACKAGE_NAME LICENSE _locales/**/* icons/* css/* dist/* svg/* manifest.json html/browser_action.html |
59 | | - |
60 | | - - name: Attach packages to GitHub Release |
61 | | - env: |
62 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
63 | | - run: | |
64 | | - GH_RELEASE_ID=${{ github.event.release.id }} |
65 | | - GH_REPO="https://uploads.github.com/repos/${{ github.repository }}/releases/$GH_RELEASE_ID/assets" |
66 | | - PACKAGE_NAME="BandcampEnhancementSuite_${BROWSER}-$VERSION.zip" |
67 | | - |
68 | | - curl -L \ |
69 | | - -X POST \ |
70 | | - -H "Accept: application/vnd.github+json" \ |
71 | | - -H "Authorization: Bearer $GITHUB_TOKEN" \ |
72 | | - -H "X-GitHub-Api-Version: 2022-11-28" \ |
73 | | - -H "Content-Type: application/octet-stream" \ |
74 | | - "$GH_REPO?name=$PACKAGE_NAME" \ |
75 | | - --data-binary "@$PACKAGE_NAME" |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Setup pnpm |
| 20 | + uses: pnpm/action-setup@v4 |
| 21 | + with: |
| 22 | + version: 9.14.4 |
| 23 | + |
| 24 | + - name: Use Node.js |
| 25 | + uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node-version: '22.x' |
| 28 | + cache: 'pnpm' |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: pnpm install --frozen-lockfile |
| 32 | + |
| 33 | + - name: TypeScript type check |
| 34 | + run: pnpm run typecheck |
| 35 | + |
| 36 | + - name: Set version number in manifest |
| 37 | + run: | |
| 38 | + VERSION_NUMBER=$(echo ${VERSION} | sed 's/^v//') |
| 39 | + sed -i 's/"version": *"[0-9.]*"/"version": "'$VERSION_NUMBER'"/' manifest.json |
| 40 | +
|
| 41 | + - name: Build Chrome |
| 42 | + if: ${{ matrix.container == 'chrome' }} |
| 43 | + run: pnpm run build |
| 44 | + |
| 45 | + - name: Build Firefox |
| 46 | + if: ${{ matrix.container == 'firefox' }} |
| 47 | + run: | |
| 48 | + sed -i 's,"service_worker": "dist/background.js","scripts": ["dist/background.js"],g' ./manifest.json |
| 49 | + pnpm run build |
| 50 | +
|
| 51 | + - name: Package extension |
| 52 | + run: | |
| 53 | + PACKAGE_NAME="BandcampEnhancementSuite_${BROWSER}-$VERSION.zip" |
| 54 | + zip $PACKAGE_NAME LICENSE _locales/**/* icons/* css/* dist/* svg/* manifest.json html/browser_action.html |
| 55 | +
|
| 56 | + - name: Attach packages to GitHub Release |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + run: | |
| 60 | + GH_RELEASE_ID=${{ github.event.release.id }} |
| 61 | + GH_REPO="https://uploads.github.com/repos/${{ github.repository }}/releases/$GH_RELEASE_ID/assets" |
| 62 | + PACKAGE_NAME="BandcampEnhancementSuite_${BROWSER}-$VERSION.zip" |
| 63 | +
|
| 64 | + curl -L \ |
| 65 | + -X POST \ |
| 66 | + -H "Accept: application/vnd.github+json" \ |
| 67 | + -H "Authorization: Bearer $GITHUB_TOKEN" \ |
| 68 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 69 | + -H "Content-Type: application/octet-stream" \ |
| 70 | + "$GH_REPO?name=$PACKAGE_NAME" \ |
| 71 | + --data-binary "@$PACKAGE_NAME" |
0 commit comments