55 tags :
66 - " v*"
77
8+ permissions :
9+ contents : write
10+
811jobs :
912 build-frontend :
1013 runs-on : ubuntu-latest
1114 steps :
1215 - name : Checkout repository
13- uses : actions/checkout@v3
16+ uses : actions/checkout@v4
17+
18+ - name : Setup pnpm
19+ uses : pnpm/action-setup@v4
20+ with :
21+ version : 9
1422
1523 - name : Set up Node.js
16- uses : actions/setup-node@v3
24+ uses : actions/setup-node@v4
1725 with :
18- node-version : 18
26+ node-version : " 20"
27+ cache : " pnpm"
1928
2029 - name : Install dependencies
21- run : yarn install
30+ run : pnpm install --frozen-lockfile
31+
32+ - name : TypeScript type check
33+ run : pnpm run build2
2234
2335 - name : Build
24- run : yarn build
36+ run : pnpm run build
2537
2638 - name : Upload frontend artifact
2739 uses : actions/upload-artifact@v4
2840 with :
2941 name : frontend-dist
3042 path : dist
43+ retention-days : 30
3144
3245 build-desktop :
3346 needs : build-frontend
3447 strategy :
48+ fail-fast : false
3549 matrix :
36- include :
37- - os : windows-latest
38- artifact_name : web-serial-windows
39- asset_name : web-serial-windows.zip
40- - os : macos-latest
41- artifact_name : web-serial-macos
42- asset_name : web-serial-macos.zip
43- - os : ubuntu-22.04
44- artifact_name : web-serial-linux
45- asset_name : web-serial-linux.zip
46-
47- runs-on : ${{ matrix.os }}
50+ goos : [windows, darwin, linux]
51+ goarch : [amd64, arm64]
52+ exclude :
53+ - goos : darwin
54+ goarch : amd64
55+
56+ runs-on : ${{ matrix.goos == 'darwin' && 'macos-latest' || (matrix.goos == 'windows' && 'windows-latest' || 'ubuntu-22.04') }}
4857 steps :
4958 - name : Checkout repository
50- uses : actions/checkout@v3
59+ uses : actions/checkout@v4
5160
5261 - name : Set up Go
53- uses : actions/setup-go@v4
62+ uses : actions/setup-go@v5
5463 with :
55- go-version : ' 1.21'
64+ go-version : " 1.21"
65+ cache-dependency-path : window/go.sum
5666
5767 - name : Install Linux dependencies
58- if : matrix.os == 'ubuntu-22.04 '
68+ if : matrix.goos == 'linux '
5969 run : |
6070 sudo apt-get update
6171 sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev
@@ -71,25 +81,39 @@ jobs:
7181 run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
7282
7383 - name : Build desktop app
84+ env :
85+ VERSION : ${{ steps.version.outputs.VERSION }}
86+ GOOS : ${{ matrix.goos }}
87+ GOARCH : ${{ matrix.goarch }}
7488 run : |
7589 cd window
76- go build -v -ldflags "-X main.version=${{ steps.version.outputs.VERSION }}" -o ${{ matrix.artifact_name }}
90+ OUTPUT_NAME="web-serial-${{ matrix.goos }}-${{ matrix.goarch }}"
91+ EXT=""
92+ if [ "${{ matrix.goos }}" = "windows" ]; then
93+ EXT=".exe"
94+ fi
95+ go build -v -ldflags "-X main.version=${VERSION} -X main.buildTime=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -o "${OUTPUT_NAME}${EXT}"
7796
7897 - name : Create release asset
79- if : matrix.os != 'windows-latest'
80- run : |
81- cd window
82- zip -r ${{ matrix.asset_name }} ${{ matrix.artifact_name }} ./dist
83-
84- - name : Create release asset (Windows)
85- if : matrix.os == 'windows-latest'
8698 run : |
8799 cd window
88- powershell -Command "Compress-Archive -Path ${{ matrix.artifact_name }},dist -DestinationPath ${{ matrix.asset_name }}"
100+ OUTPUT_NAME="web-serial-${{ matrix.goos }}-${{ matrix.goarch }}"
101+ EXT=""
102+ if [ "${{ matrix.goos }}" = "windows" ]; then
103+ EXT=".exe"
104+ fi
105+ if [ "${{ matrix.goos }}" = "linux" ]; then
106+ tar -czf "${OUTPUT_NAME}.tar.gz" "${OUTPUT_NAME}${EXT}" ./dist
107+ else
108+ zip -r "${OUTPUT_NAME}.zip" "${OUTPUT_NAME}${EXT}" ./dist
109+ fi
89110
90111 - name : Upload release asset
91- uses : softprops/action-gh-release@v1
112+ uses : softprops/action-gh-release@v2
92113 with :
93- files : window/${{ matrix.asset_name }}
114+ files : window/web-serial-${{ matrix.goos }}-${{ matrix.goarch }}.*
115+ generate_release_notes : true
116+ draft : false
117+ prerelease : ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
94118 env :
95119 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments