@@ -47,10 +47,19 @@ jobs:
47
47
48
48
strategy :
49
49
matrix :
50
- os :
51
- - ubuntu-latest
52
- - windows-latest
53
- - macos-latest
50
+ include :
51
+ - target : x86_64-unknown-linux-gnu
52
+ os : ubuntu-latest
53
+ name : xsnippet-api-x86_64-linux.gz
54
+ - target : aarch64-unknown-linux-gnu
55
+ os : ubuntu-latest
56
+ name : xsnippet-api-aarch64-linux.gz
57
+ - target : x86_64-pc-windows-msvc
58
+ os : windows-latest
59
+ name : xsnippet-api-x86_64-windows.exe.7z
60
+ - target : aarch64-apple-darwin
61
+ os : macos-latest
62
+ name : xsnippet-api-aarch64-macos.gz
54
63
55
64
runs-on : ${{ matrix.os }}
56
65
@@ -66,31 +75,31 @@ jobs:
66
75
- name : Setup PostgreSQL
67
76
uses : ikalnytskyi/action-setup-postgres@v6
68
77
69
- - uses : actions-rs/cargo@v1
70
- with :
71
- command : build
72
- args : --release
73
-
74
78
- id : build
75
79
run : |
76
- rustc --print cfg | grep = > rustc.vars
77
- source rustc.vars
80
+ export HOST=$(rustc +nightly -Z unstable-options --print target-spec-json | jq --raw-output '."llvm-target"')
81
+ if [ "$HOST" = "$TARGET" ]; then
82
+ cargo build --release --target ${TARGET}
83
+ else
84
+ cargo install cross
85
+ cross build --release --target ${TARGET}
86
+ fi
78
87
79
- pushd target/release
80
- if [ "$RUNNER_OS" == "Windows" ]; then
81
- export ASSET_NAME="xsnippet-api-${target_arch}-${target_os}.exe.7z"
88
+ pushd target/${TARGET}/release
89
+ if [ "$TARGET" =~ "windows" ]; then
82
90
7z a $ASSET_NAME xsnippet-api.exe
83
91
else
84
- export ASSET_NAME="xsnippet-api-${target_arch}-${target_os}.gz"
85
92
tar cvzf $ASSET_NAME xsnippet-api
86
93
fi
87
94
gh release upload $RELEASE_TAG $ASSET_NAME
88
95
popd
89
96
90
- echo "asset_path=target/release /$ASSET_NAME" >> $GITHUB_OUTPUT
97
+ echo "asset_path=$PWD /$ASSET_NAME" >> $GITHUB_OUTPUT
91
98
env :
99
+ ASSET_NAME : ${{ matrix.name }}
92
100
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
93
101
GH_REPO : ${{ env.GITHUB_REPOSITORY }}
102
+ TARGET : ${{ matrix.target }}
94
103
RELEASE_TAG : ${{ needs.create_release.outputs.release_tag }}
95
104
96
105
- uses : actions/attest-build-provenance@v1
0 commit comments