@@ -87,15 +87,23 @@ jobs:
8787 include :
8888 - os : ubuntu-20.04
8989 dist-args : --artifacts=global
90+ target : ' '
9091 install-dist : curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.sh | sh
9192 - os : macos-11
9293 dist-args : --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin
94+ target : ' aarch64-apple-darwin x86_64-apple-darwin'
9395 install-dist : curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.sh | sh
9496 - os : ubuntu-20.04
9597 dist-args : --artifacts=local --target=x86_64-unknown-linux-gnu
98+ target : ' x86_64-unknown-linux-gnu'
9699 install-dist : curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.sh | sh
100+ - os : ubuntu-20.04
101+ dist-args : --artifacts=local --target=aarch64-unknown-linux-gnu
102+ target : ' aarch64-unknown-linux-gnu'
103+ install-dist : curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.sh | sh
97104 - os : windows-2019
98105 dist-args : --artifacts=local --target=x86_64-pc-windows-msvc
106+ target : ' x86_64-pc-windows-msvc'
99107 install-dist : irm https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.ps1 | iex
100108
101109 runs-on : ${{ matrix.os }}
@@ -108,17 +116,36 @@ jobs:
108116 - name : Install cargo-dist
109117 run : ${{ matrix.install-dist }}
110118 - name : Run cargo-dist
119+ if : ${{ matrix.target != '' }}
111120 # This logic is a bit janky because it's trying to be a polyglot between
112121 # powershell and bash since this will run on windows, macos, and linux!
113122 # The two platforms don't agree on how to talk about env vars but they
114123 # do agree on 'cat' and '$()' so we use that to marshal values between commands.
115124 run : |
116- # Actually do builds and make zips and whatnot
117- cargo dist build --tag=${{ github.ref_name }} --output-format=json ${{ matrix.dist-args }} > dist-manifest.json
118- echo "dist ran successfully"
125+ pip3 install ziglang
126+ cargo install cargo-zigbuild
127+ rustup target add ${{ matrix.target }}
128+ cargo zigbuild --target ${{ matrix.target }} --release
129+
130+ # Set binary name to typeshare
131+ BINARY_NAME="typeshare"
132+ TARGET_DIR="target/${{ matrix.target }}/release"
133+
134+ # Create zip directory
135+ mkdir -p "dist"
136+
137+ # Create zip file with binary
138+ ZIP_NAME="${BINARY_NAME}-${{ github.ref_name }}-${{ matrix.target }}.zip"
139+ cd ${TARGET_DIR} && zip "../../../dist/${ZIP_NAME}" "${BINARY_NAME}${BINARY_SUFFIX}"
140+ cd ../../..
141+
142+ # Create manifest file similar to cargo-dist
143+ echo "{\"artifacts\" : [{\"path\": \"dist/${ZIP_NAME}\"}]}" > dist-manifest.json
144+
145+ echo "Build complete, contents of dist-manifest.json:"
119146 cat dist-manifest.json
120-
121- # Parse out what we just built and upload it to the Github Release™
147+
148+ # Upload to release
122149 cat dist-manifest.json | jq --raw-output ".artifacts[]?.path | select( . != null )" > uploads.txt
123150 echo "uploading..."
124151 cat uploads.txt
0 commit comments