Skip to content

Commit 04d757d

Browse files
committed
refactor: matrix strategy
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent d260737 commit 04d757d

2 files changed

Lines changed: 54 additions & 163 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,27 @@ permissions:
77
contents: read
88

99
jobs:
10-
build-macos:
11-
name: Build macOS (electron-builder)
12-
runs-on: macos-latest
10+
build:
11+
name: Build ${{ matrix.platform }} (electron-builder)
12+
strategy:
13+
matrix:
14+
include:
15+
- os: macos-latest
16+
platform: macOS
17+
package-cmd: pnpm package:macos --publish=never -c.mac.identity=null
18+
cleanup-path: dist/mac-universal
19+
artifact-name: Gitify-dist-mac
20+
- os: windows-latest
21+
platform: Windows
22+
package-cmd: pnpm package:win --publish=never
23+
cleanup-path: dist/win-unpacked
24+
artifact-name: Gitify-dist-win
25+
- os: ubuntu-latest
26+
platform: Linux
27+
package-cmd: pnpm package:linux --publish=never
28+
cleanup-path: dist/linux-unpacked
29+
artifact-name: Gitify-dist-linux
30+
runs-on: ${{ matrix.os }}
1331

1432
steps:
1533
- name: Checkout
@@ -30,90 +48,20 @@ jobs:
3048
- name: Build application
3149
run: pnpm build
3250

33-
- name: Package for macOS
34-
run: pnpm package:macos --publish=never -c.mac.identity=null
51+
- name: Package for ${{ matrix.platform }}
52+
run: ${{ matrix.package-cmd }}
3553
env:
54+
# For macOS
3655
CSC_LINK: ${{ secrets.CSC_LINK }}
3756
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
3857

3958
- name: Clean up builds
40-
run: rm -rfv dist/mac-universal
59+
shell: bash
60+
run: rm -rfv ${{ matrix.cleanup-path }}
4161

4262
- name: Upload artifacts
4363
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
4464
with:
45-
name: Gitify-dist-mac
65+
name: ${{ matrix.artifact-name }}
4666
path: dist/
4767
overwrite: true
48-
49-
build-windows:
50-
name: Build Windows (electron-builder)
51-
runs-on: windows-latest
52-
53-
steps:
54-
- name: Checkout
55-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
56-
57-
- name: Setup pnpm
58-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
59-
60-
- name: Setup Node
61-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
62-
with:
63-
node-version-file: .nvmrc
64-
cache: pnpm
65-
66-
- name: Install dependencies
67-
run: pnpm install --frozen-lockfile
68-
69-
- name: Build application
70-
run: pnpm build
71-
72-
- name: Package for Windows
73-
run: pnpm package:win --publish=never
74-
75-
- name: Clean up builds
76-
run: Remove-Item dist/win-unpacked -Recurse
77-
78-
- name: Upload artifacts
79-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
80-
with:
81-
name: Gitify-dist-win
82-
path: dist
83-
overwrite: true
84-
85-
build-linux:
86-
name: Build Linux (electron-builder)
87-
runs-on: ubuntu-latest
88-
89-
steps:
90-
- name: Checkout
91-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
92-
93-
- name: Setup pnpm
94-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
95-
96-
- name: Setup Node
97-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
98-
with:
99-
node-version-file: .nvmrc
100-
cache: pnpm
101-
102-
- name: Install dependencies
103-
run: pnpm install --frozen-lockfile
104-
105-
- name: Build application
106-
run: pnpm build
107-
108-
- name: Package for Linux
109-
run: pnpm package:linux --publish=never
110-
111-
- name: Clean up builds
112-
run: rm -rfv dist/linux-unpacked
113-
114-
- name: Upload artifacts
115-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
116-
with:
117-
name: Gitify-dist-linux
118-
path: dist
119-
overwrite: true

.github/workflows/publish.yml

Lines changed: 27 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,27 @@ permissions:
88
contents: write
99

1010
jobs:
11-
release-macos:
12-
name: Publish macOS (electron-builder)
13-
runs-on: macos-latest
11+
release:
12+
name: Publish ${{ matrix.platform }} (electron-builder)
13+
strategy:
14+
matrix:
15+
include:
16+
- os: macos-latest
17+
platform: macOS
18+
package-cmd: pnpm package:macos --publish onTagOrDraft
19+
artifact-name: Gitify-release-mac
20+
use-apple-notarization: true
21+
- os: windows-latest
22+
platform: Windows
23+
package-cmd: pnpm package:win --publish onTagOrDraft
24+
artifact-name: Gitify-release-win
25+
use-apple-notarization: false
26+
- os: ubuntu-latest
27+
platform: Linux
28+
package-cmd: pnpm package:linux --publish onTagOrDraft
29+
artifact-name: Gitify-release-linux
30+
use-apple-notarization: false
31+
runs-on: ${{ matrix.os }}
1432

1533
steps:
1634
- name: Checkout
@@ -34,96 +52,21 @@ jobs:
3452
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
3553
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
3654

37-
- name: Package and publish for macOS
38-
run: pnpm package:macos --publish onTagOrDraft
55+
- name: Package and publish for ${{ matrix.platform }}
56+
run: ${{ matrix.package-cmd }}
3957
env:
58+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
# For macOS
4060
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
4161
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
4262
APPLE_ID_TEAM_ID: ${{ secrets.APPLE_ID_TEAM_ID }}
4363
CSC_LINK: ${{ secrets.CSC_LINK }}
4464
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
45-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46-
NOTARIZE: true
47-
48-
- name: Upload artifacts
49-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
50-
with:
51-
name: Gitify-release-mac
52-
path: dist/
53-
overwrite: true
54-
55-
release-windows:
56-
name: Publish Windows (electron-builder)
57-
runs-on: windows-latest
58-
59-
steps:
60-
- name: Checkout
61-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
62-
63-
- name: Setup pnpm
64-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
65-
66-
- name: Setup Node
67-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
68-
with:
69-
node-version-file: .nvmrc
70-
cache: pnpm
71-
72-
- name: Install dependencies
73-
run: pnpm install --frozen-lockfile
74-
75-
- name: Build application
76-
run: pnpm build
77-
env:
78-
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
79-
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
80-
81-
- name: Package and publish for Windows
82-
run: pnpm package:win --publish onTagOrDraft
83-
env:
84-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85-
86-
- name: Upload artifacts
87-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
88-
with:
89-
name: Gitify-release-win
90-
path: dist/
91-
overwrite: true
92-
93-
release-linux:
94-
name: Publish Linux (electron-builder)
95-
runs-on: ubuntu-latest
96-
97-
steps:
98-
- name: Checkout
99-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
100-
101-
- name: Setup pnpm
102-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
103-
104-
- name: Setup Node
105-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
106-
with:
107-
node-version-file: .nvmrc
108-
cache: pnpm
109-
110-
- name: Install dependencies
111-
run: pnpm install --frozen-lockfile
112-
113-
- name: Build application
114-
run: pnpm build
115-
env:
116-
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
117-
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
118-
119-
- name: Package and publish for Linux
120-
run: pnpm package:linux --publish onTagOrDraft
121-
env:
122-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
NOTARIZE: ${{ matrix.use-apple-notarization }}
12366

12467
- name: Upload artifacts
12568
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
12669
with:
127-
name: Gitify-release-linux
70+
name: ${{ matrix.artifact-name }}
12871
path: dist/
12972
overwrite: true

0 commit comments

Comments
 (0)