@@ -30,34 +30,72 @@ jobs:
3030
3131 - name : Build
3232 run : |
33- mkdir bin
3433 GOARCH=arm64 go build -ldflags="-s -w" -o mobilectl-arm64
3534 GOARCH=amd64 go build -ldflags="-s -w" -o mobilectl-amd64
36- lipo mobilectl-arm64 mobilectl-amd64 -create -output mobilectl
35+ lipo mobilectl-arm64 mobilectl-amd64 -create -output mobilectl-darwin
3736 rm mobilectl-arm64 mobilectl-amd64
3837
3938 - name : Upload macos build artifact
4039 uses : actions/upload-artifact@v4
4140 with :
4241 name : macos-build
4342 path : |
44- mobilectl
43+ mobilectl-darwin
4544 retention-days : 1
4645 overwrite : true
4746
48- publish :
47+ build_on_linux :
4948
5049 runs-on : ubuntu-latest
5150 needs : build_on_macos
5251 steps :
5352 - uses : actions/checkout@v4
5453
55- - name : Download macos build
54+ - name : Set up Go
55+ uses : actions/setup-go@v5
56+ with :
57+ go-version-file : go.mod
58+
59+ - name : Install dependencies
60+ run : |
61+ go get golang.org/x/tools/cmd/goimports@latest
62+ go get github.com/golangci/golangci-lint/cmd/golangci-lint@latest
63+
64+ - name : Build
65+ run : |
66+ GOARCH=arm64 go build -ldflags="-s -w" -o mobilectl-linux-arm64
67+ GOARCH=amd64 go build -ldflags="-s -w" -o mobilectl-linux-amd64
68+
69+ - name : Upload macos build artifact
70+ uses : actions/upload-artifact@v4
71+ with :
72+ name : linux-build
73+ path : |
74+ mobilectl-darwin
75+ mobilectl-linux-arm64
76+ mobilectl-linux-amd64
77+ retention-days : 1
78+ overwrite : true
79+
80+ publish :
81+
82+ runs-on : ubuntu-latest
83+ needs : build_on_linux
84+ steps :
85+ - uses : actions/checkout@v4
86+
87+ - name : Download darwin build
5688 uses : actions/download-artifact@v4
5789 with :
5890 name : macos-build
59- path : mobilectl-macos
91+ path : mobilectl-darwin
6092
93+ - name : Download linux build
94+ uses : actions/download-artifact@v4
95+ with :
96+ name : linux-build
97+ path : mobilectl-linux
98+
6199 - uses : AButler/upload-release-assets@v2.0
62100 with :
63101 files : " *.zip"
@@ -69,12 +107,13 @@ jobs:
69107 NPM_AUTH_TOKEN : ${{ secrets.NPM_AUTH_TOKEN }}
70108 run : |
71109 # prepare binaries for distribution
72- mv ./mobilectl-macos/mobilectl publish/npm/bin/mobilectl
73- chmod +x publish/npm/bin/mobilectl
110+ find . -ls
111+ mv ./mobilectl-darwin/mobilectl-darwin publish/npm/bin/mobilectl-darwin
112+ chmod +x publish/npm/bin/*
74113 # setup npmrc
75114 echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
76115 # sed -i 's/\"local-build\"/\"${{ env.release_tag }}\"/' package.json
77116 # publish to npm
78117 cd publish/npm
79118 npm install
80- npm publish
119+ # npm publish
0 commit comments