66
77jobs :
88 build-and-publish-binaries :
9- name : Build binaries (${{ matrix.target }})
9+ name : Build binaries (${{ matrix.name }})
1010 strategy :
1111 matrix :
1212 include :
13- - os : windows-latest
14- target : win
15- - os : ubuntu-latest
16- target : linux
17- - os : macos-latest
18- target : macos
13+ - name : win-x64
14+ target : windows-x64 --windows-icon=.github/workflows/filen-icon.ico
15+ os : windows-11-arm # see note below
16+ - name : linux-x64
17+ target : linux-x64
18+ os : ubuntu-latest
19+ - name : linux-arm64
20+ target : linux-arm64
21+ os : ubuntu-24.04-arm
22+ - name : macos-x64
23+ target : macos-x64
24+ os : macos-latest
25+ - name : macos-arm64
26+ target : macos-arm64
27+ os : macos-latest
1928 runs-on : ${{ matrix.os }}
2029 permissions :
2130 contents : write
2231 steps :
2332 - name : Checkout
2433 uses : actions/checkout@v3
25- - name : Inject version
26- uses : richardrigutins/replace-in-files@v2
34+ - name : Install bun
35+ if : ${{ matrix.os != 'windows-11-arm' }}
36+ uses : oven-sh/setup-bun@v2
37+ # Installing Bun on Windows is a bit different:
38+ # Bun doesn't support Windows ARM64 (yet?), so we're installing the x64 version, which can be run on Windows arm64 machines via emulation.
39+ # However, it seems that the x64 binary built on x64 can't be run on arm64, so we need to build the x64 binary on an arm64 machine.
40+ # The oven-sh/setup-bun action doesn't support installing x64 Bun on arm64, so we do it manually using the install script (and then add it to the PATH).
41+ - name : Install bun (Windows)
42+ if : ${{ matrix.os == 'windows-11-arm' }}
43+ run : powershell -c "irm bun.sh/install.ps1|iex"
44+ - name : Add bun to path (Windows)
45+ if : ${{ matrix.os == 'windows-11-arm' }}
46+ uses : actions/github-script@v7
2747 with :
28- files : " package.json"
29- search-text : " \" version\" : \" 0.0.0\" "
30- replacement-text : " \" version\" : \" ${{ github.event.release.tag_name }}\" "
31- - name : Setup Node
32- uses : actions/setup-node@v4
33- with :
34- node-version-file : .node-version
35- - run : npm ci
36- - run : npm run package-${{ matrix.target }}
48+ script : core.addPath('C:\\Users\\runneradmin\\.bun\\bin');
49+ - run : bun install
50+ - run : bun run compile --target=bun-${{ matrix.target }} --define "FILEN_CLI_VERSION=${{ github.event.release.tag_name }}" --outfile dist/filen-cli-${{ github.event.release.tag_name }}-${{ matrix.name }}
3751 - name : Codesign and notarize on macOS
38- if : ${{ matrix.target == 'macos' }}
52+ if : ${{ matrix.os == 'macos-latest ' }}
3953 env :
4054 APPLE_DEVELOPER_ID_CERT : ${{ secrets.APPLE_DEVELOPER_ID_CERT }}
4155 APPLE_DEVELOPER_ID_CERT_PASS : ${{ secrets.APPLE_DEVELOPER_ID_CERT_PASS }}
@@ -53,21 +67,27 @@ jobs:
5367 security unlock-keychain -p actions ~/Library/Keychains/build.keychain
5468 security set-key-partition-list -S apple-tool:,apple: -s -k actions ~/Library/Keychains/build.keychain
5569 # codesign
56- codesign --sign "Developer ID Application: Filen Cloud Dienste UG (haftungsbeschraenkt)" --options runtime --force --deep --keychain ~/Library/Keychains/build.keychain --entitlements=../.github/workflows/entitlements.plist filen-cli-macos-x64 filen-cli-macos-arm64
70+ codesign --sign "Developer ID Application: Filen Cloud Dienste UG (haftungsbeschraenkt)" --options runtime --force --deep --keychain ~/Library/Keychains/build.keychain --entitlements=../.github/workflows/entitlements.plist filen-cli-${{ github.event.release.tag_name }}-${{ matrix.name }}
5771 # notarize
58- zip filen-cli-macos.zip filen-cli-macos-x64 filen-cli-macos-arm64
72+ zip filen-cli-macos.zip filen-cli-${{ github.event.release.tag_name }}-${{ matrix.name }}
5973 xcrun notarytool submit filen-cli-macos.zip --apple-id $APPLE_NOTARIZE_ID --password $APPLE_NOTARIZE_PASS --team-id $APPLE_NOTARIZE_TEAM_ID --output-format json --wait 2>&1 | tee notarization_info.json
6074 id=$(cat notarization_info.json | jq -r '.id')
6175 xcrun notarytool log $id --apple-id $APPLE_NOTARIZE_ID --password $APPLE_NOTARIZE_PASS --team-id $APPLE_NOTARIZE_TEAM_ID
6276 # cleanup certificate
6377 security delete-keychain build.keychain
6478 rm -f certificate.p12
65- - name : Rename binaries to include release number
66- run : node -e "['win-x64.exe', 'win-arm64.exe', 'linux-x64', 'linux-arm64', 'macos-x64', 'macos-arm64'].forEach(suffix => { if (fs.existsSync('dist/filen-cli-'+suffix)) { fs.renameSync('dist/filen-cli-'+suffix, 'dist/filen-cli-${{ github.event.release.tag_name }}-'+suffix) } })"
79+ rm filen-cli-macos.zip
80+ - name : Execute binary
81+ if : ${{ matrix.target != 'macos-x64' }}
82+ run : dist/filen-cli-${{ github.event.release.tag_name }}-${{ matrix.name }} --help
83+ - name : Copy win-x64 binary as win-arm64 binary
84+ # so the updater won't be confused
85+ if : ${{ matrix.os == 'windows-11-arm' }}
86+ run : cp dist/filen-cli-${{ github.event.release.tag_name }}-win-x64.exe dist/filen-cli-${{ github.event.release.tag_name }}-win-arm64.exe
6787 - name : Attach binaries to release
6888 uses : softprops/action-gh-release@v2
6989 with :
70- files : dist/filen-cli-${{ github.event.release.tag_name }}- *
90+ files : dist/filen-cli-*
7191
7292 build-and-publish-npm :
7393 name : Build and publish to npm
@@ -82,29 +102,23 @@ jobs:
82102 files : " package.json"
83103 search-text : " \" version\" : \" 0.0.0\" "
84104 replacement-text : " \" version\" : \" ${{ github.event.release.tag_name }}\" "
105+ - name : Install bun
106+ uses : oven-sh/setup-bun@v2
107+ - run : bun install
108+ - run : bun build --target=node --sourcemap --define VERSION="${{ github.event.release.tag_name }}" --define IS_RUNNING_AS_NPM_PACKAGE=true src/index.ts --outdir build --external "@jupiterpi/node-keyring" --external "@parcel/watcher"
85109 - name : Setup Node
86110 uses : actions/setup-node@v4
87- with :
88- node-version-file : .node-version
89- registry-url : " https://registry.npmjs.org"
90- - run : npm ci
91- - run : npm publish --access public # includes build
111+ - run : npm publish --access public
92112 env :
93- FILEN_IS_NPM_PACKAGE : true
94113 NODE_AUTH_TOKEN : ${{ secrets.NPM_PUBLISH_TOKEN }}
95114
96115 build-and-publish-docker :
97116 name : Build Docker image
98117 runs-on : ubuntu-latest
99118 if : ${{ github.event.release.prerelease == false }}
100119 steps :
101- - uses : actions/checkout@v3
102- - name : Inject version
103- uses : richardrigutins/replace-in-files@v2
104- with :
105- files : " package.json"
106- search-text : " \" version\" : \" 0.0.0\" "
107- replacement-text : " \" version\" : \" ${{ github.event.release.tag_name }}\" "
120+ - name : Checkout
121+ uses : actions/checkout@v3
108122 - name : Log in to Docker Hub
109123 uses : docker/login-action@v3
110124 with :
@@ -139,13 +153,11 @@ jobs:
139153 files : " package.json"
140154 search-text : " \" version\" : \" 0.0.0\" "
141155 replacement-text : " \" version\" : \" ${{ github.event.release.tag_name }}\" "
156+ - name : Install bun
157+ uses : oven-sh/setup-bun@v2
158+ - run : bun install
142159 - name : Setup Node
143160 uses : actions/setup-node@v4
144- with :
145- node-version-file : .node-version
146- - run : npm ci
147- - name : Build filen-cli
148- run : npm run build
149161 - name : Build docs
150162 run : chmod +x build-docs.sh && ./build-docs.sh && mv filen-cli-docs.html filen-cli-${{ github.event.release.tag_name }}-docs.html
151163 - name : Attach HTML file to release
0 commit comments