1+ name : fornet arm64 client build
2+ # run at self-hosted mac min M2
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ version :
7+ required : true
8+ description : " version to release"
9+ env :
10+ REGISTRY : ghcr.io
11+ jobs :
12+ docker-and-linux :
13+ runs-on : self-hosted
14+ steps :
15+ - uses : actions/checkout@v3
16+ with :
17+ submodules : true
18+ -
19+ name : Set up Docker Buildx
20+ uses : docker/setup-buildx-action@v2
21+ -
22+ name : Login to GithubPackages
23+ uses : docker/login-action@v2
24+ with :
25+ registry : ${{ env.REGISTRY }}
26+ username : ${{ github.actor }}
27+ password : ${{ secrets.GITHUB_TOKEN }}
28+ -
29+ name : build and push docker image
30+ uses : docker/build-push-action@v2
31+ with :
32+ context : .
33+ # platforms: linux/amd64,linux/arm64
34+ push : true
35+ file : command/docker/client/client.Dockerfile
36+ cache-from : type=gha
37+ cache-to : type=gha,mode=max
38+ tags : ${{ env.REGISTRY }}/fornetcode/fornet:${{github.event.inputs.version}}, ${{ env.REGISTRY }}/fornetcode/fornet:latest
39+ - name : copy binary from docker to release directory
40+ run : |
41+ mkdir -p release
42+ docker run --rm -v ./release:/release ${{ env.REGISTRY }}/fornetcode/fornet:${{github.event.inputs.version}} cp /bin/fornet:/release/ && cp /bin/fornet-cli:/release
43+ cd release && tar -czvf release/fornet-linux-aarch64.tar.gz ./fornet ./fornet-cli && rm fornet && rm fornet-cli
44+
45+ - name : Upload artifact
46+ uses : actions/upload-artifact@v2
47+ with :
48+ path : release/*
49+ if-no-files-found : error
50+
51+ mac :
52+ strategy :
53+ max-parallel : 1
54+ fail-fast : true
55+ matrix :
56+ settings :
57+ - host : self-hosted
58+ target : aarch64-apple-darwin
59+ build : make release-mac-aarch64
60+
61+ runs-on : ${{ matrix.settings.host }}
62+ steps :
63+ - uses : actions/checkout@v3
64+ with :
65+ submodules : true
66+ - name : Install Rust
67+ uses : actions-rs/toolchain@v1
68+ with :
69+ toolchain : stable
70+ target : ${{ matrix.settings.target }}
71+ profile : minimal
72+ - name : Set up cargo cache
73+ uses : actions/cache@v3
74+ continue-on-error : false
75+ with :
76+ path : |
77+ ~/.cargo/bin/
78+ ~/.cargo/registry/index/
79+ ~/.cargo/registry/cache/
80+ ~/.cargo/git/db/
81+ client/target/
82+ key : ${{ matrix.settings.host }}-${{ matrix.settings.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
83+ restore-keys : ${{ matrix.settings.host }}-cargo-${{ matrix.settings.target }}
84+ # - name: Setup tmate session
85+ # uses: mxschmitt/action-tmate@v3
86+ - name : Build
87+ run : ${{ matrix.settings.build }}
88+
89+ - name : Upload artifact
90+ uses : actions/upload-artifact@v2
91+ with :
92+ path : release/*
93+ if-no-files-found : error
0 commit comments