30
30
MSRV : " 1.75"
31
31
SCCACHE_CACHE_SIZE : " 50G"
32
32
BIN_NAMES : " iroh,iroh-relay,iroh-dns-server"
33
+ RELEASE_VERSION : ${{ github.event.inputs.release_version }}
33
34
34
35
jobs :
35
36
create-release :
@@ -39,13 +40,18 @@ jobs:
39
40
upload_url : ${{ steps.release.outputs.upload_url }}
40
41
release_version : ${{ env.RELEASE_VERSION }}
41
42
steps :
42
- - name : Get the release version from the tag (push)
43
+ - name : Get the release version from the tag or input
43
44
shell : bash
44
- if : env.RELEASE_VERSION == '' && github.event_name == 'push'
45
+ if : env.RELEASE_VERSION == ''
45
46
run : |
46
- # See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
47
- echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
48
- echo "version is: ${{ env.RELEASE_VERSION }}"
47
+ if "${{ github.event.inputs.release_version }}" != ""; then
48
+ echo "RELEASE_VERSION=${{ github.event.inputs.release_version }}" >> $GITHUB_ENV
49
+ echo "version is: ${{ env.RELEASE_VERSION }}"
50
+ else
51
+ # See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
52
+ echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
53
+ echo "version is: ${{ env.RELEASE_VERSION }}"
54
+ fi
49
55
- name : Checkout repository
50
56
uses : actions/checkout@v4
51
57
with :
57
63
env :
58
64
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
59
65
with :
66
+ draft : true
60
67
tag_name : ${{ env.RELEASE_VERSION || github.event.inputs.release_version}}
61
68
release_name : ${{ env.RELEASE_VERSION || github.event.inputs.release_version }}
62
69
@@ -138,13 +145,18 @@ jobs:
138
145
rustup target add ${{ matrix.cargo_targets }}
139
146
140
147
- name : build release
148
+ if : matrix.os != 'windows-latest'
141
149
shell : bash
142
150
run : |
143
151
if [ "${{ matrix.name }}" = "ubuntu-arm-latest" ]; then
144
152
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc
145
153
export CC=aarch64-linux-gnu-gcc
146
154
fi
147
155
cargo build --profile optimized-release --all-features --target ${{ matrix.cargo_targets }}
156
+
157
+ - name : build release
158
+ if : matrix.os == 'windows-latest'
159
+ run : cargo build --profile optimized-release --all-features --target ${{ matrix.cargo_targets }}
148
160
149
161
- name : attach artifacts
150
162
if : matrix.os != 'windows-latest'
@@ -204,36 +216,40 @@ jobs:
204
216
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh-dns-server s3://vorc/iroh-dns-server-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
205
217
206
218
- name : Build archives
219
+ if : matrix.os != 'windows-latest'
207
220
shell : bash
208
221
run : |
209
222
IFS=',' read -ra BIN_NAMES <<< "${{ env.BIN_NAMES }}"
210
223
ASSETS=""
211
224
for BIN_NAME in "${BIN_NAMES[@]}"; do
212
225
staging="$BIN_NAME-${{ needs.create-release.outputs.release_version }}-${{ matrix.cargo_targets }}"
213
226
mkdir -p "$staging"
214
- if [ "${{ matrix.os }}" = "windows-latest" ]; then
215
- cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME.exe" "$staging/"
216
- cd "$staging"
217
- 7z a "../$staging.zip" .
218
- ASSETS+="$staging.zip,"
219
- else
220
- cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME" "$staging/"
221
- tar czf "$staging.tar.gz" -C "$staging" .
222
- ASSETS+="$staging.tar.gz,"
223
- fi
227
+ cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME" "$staging/"
228
+ tar czf "$staging.tar.gz" -C "$staging" .
229
+ ASSETS+="$staging.tar.gz,"
224
230
done
225
- echo "ASSET=${ ASSETS::-1} " >> $GITHUB_ENV
231
+ echo "ASSET=$(echo $ ASSETS | sed 's/,$//') " >> $GITHUB_ENV
226
232
227
- - name : Upload release archives
228
- if : github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push'
233
+ - name : Build archives (windows)
234
+ if : matrix.os == 'windows-latest'
235
+ shell : pwsh
229
236
run : |
230
- IFS=',' read -ra ASSETS <<< "${{ env.ASSET }}"
231
- for ASSET in "${ASSETS[@]}"; do
232
- ASSET_NAME=$(basename $ASSET)
233
- curl \
234
- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
235
- -H "Content-Type: $(file -b --mime-type application/octet-stream)" \
236
- --data-binary @"$ASSET" \
237
- "${{ needs.create-release.outputs.upload_url }}?name=$ASSET_NAME"
238
- done
239
-
237
+ $BIN_NAMES = "${{ env.BIN_NAMES }}".Split(',')
238
+ $ASSETS = @()
239
+ foreach ($BIN_NAME in $BIN_NAMES) {
240
+ $staging = "$BIN_NAME-${{ needs.create-release.outputs.release_version }}-${{ matrix.cargo_targets }}"
241
+ New-Item -ItemType Directory -Force -Path "$staging"
242
+ Copy-Item -Path "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME.exe" -Destination "$staging/"
243
+ Set-Location -Path "$staging"
244
+ Compress-Archive -Path * -DestinationPath "../$staging.zip"
245
+ $ASSETS += "$staging.zip"
246
+ Set-Location -Path ..
247
+ }
248
+ $ASSETS = $ASSETS -join ','
249
+ Add-Content -Path $env:GITHUB_ENV -Value "ASSET=$ASSETS"
250
+
251
+ - uses : n0-computer/actions-upload-release-asset@main
252
+ if : (github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push')
253
+ with :
254
+ upload_url : ${{ needs.create-release.outputs.upload_url }}
255
+ asset_path : ${{ env.ASSET }}
0 commit comments