@@ -200,6 +200,10 @@ jobs:
200
200
run : swift --version
201
201
- name : Checkout repository
202
202
uses : actions/checkout@v4
203
+ if : ${{ matrix.os_version != 'amazonlinux2' }}
204
+ - name : Checkout repository
205
+ uses : actions/checkout@v1
206
+ if : ${{ matrix.os_version == 'amazonlinux2' }}
203
207
- name : Provide token
204
208
if : ${{ inputs.needs_token }}
205
209
run : |
@@ -232,6 +236,10 @@ jobs:
232
236
run : swift --version
233
237
- name : Checkout repository
234
238
uses : actions/checkout@v4
239
+ if : ${{ matrix.os_version != 'amazonlinux2' }}
240
+ - name : Checkout repository
241
+ uses : actions/checkout@v1
242
+ if : ${{ matrix.os_version == 'amazonlinux2' }}
235
243
- name : Provide token
236
244
if : ${{ inputs.needs_token }}
237
245
run : |
@@ -250,7 +258,18 @@ jobs:
250
258
BUILD_FLAGS : ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
251
259
run : |
252
260
${{ inputs.linux_static_sdk_pre_build_command }}
253
- which curl || (apt -q update && apt -yq install curl)
261
+ if command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy, focal
262
+ apt-get -q update && apt-get -yq install curl
263
+ elif command -v dnf >/dev/null 2>&1 ; then # rhel-ubi9
264
+ dnf -y update
265
+ dnf -y install curl-minimal
266
+ elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2
267
+ yum -y update
268
+ yum -y install curl
269
+ else
270
+ echo "Unknown package manager (tried apt-get, dnf, yum)" >&2
271
+ exit 1
272
+ fi
254
273
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
255
274
bash -s -- --static --flags="$BUILD_FLAGS" --build-command="${{ inputs.linux_static_sdk_build_command }}" ${{ matrix.swift_version }}
256
275
@@ -272,6 +291,10 @@ jobs:
272
291
run : swift --version
273
292
- name : Checkout repository
274
293
uses : actions/checkout@v4
294
+ if : ${{ matrix.os_version != 'amazonlinux2' }}
295
+ - name : Checkout repository
296
+ uses : actions/checkout@v1
297
+ if : ${{ matrix.os_version == 'amazonlinux2' }}
275
298
- name : Provide token
276
299
if : ${{ inputs.needs_token }}
277
300
run : |
@@ -290,7 +313,18 @@ jobs:
290
313
BUILD_FLAGS : ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
291
314
run : |
292
315
${{ inputs.wasm_sdk_pre_build_command }}
293
- which curl || (apt -q update && apt -yq install curl)
316
+ if command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy, focal
317
+ apt-get -q update && apt-get -yq install curl
318
+ elif command -v dnf >/dev/null 2>&1 ; then # rhel-ubi9
319
+ dnf -y update
320
+ dnf -y install curl-minimal
321
+ elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2
322
+ yum -y update
323
+ yum -y install curl
324
+ else
325
+ echo "Unknown package manager (tried apt-get, dnf, yum)" >&2
326
+ exit 1
327
+ fi
294
328
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
295
329
bash -s -- --wasm --flags="$BUILD_FLAGS" --build-command="${{ inputs.wasm_sdk_build_command }}" ${{ matrix.swift_version }}
296
330
@@ -330,7 +364,18 @@ jobs:
330
364
BUILD_FLAGS : ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
331
365
run : |
332
366
${{ inputs.wasm_sdk_pre_build_command }}
333
- which curl || (apt -q update && apt -yq install curl)
367
+ if command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy, focal
368
+ apt-get -q update && apt-get -yq install curl
369
+ elif command -v dnf >/dev/null 2>&1 ; then # rhel-ubi9
370
+ dnf -y update
371
+ dnf -y install curl-minimal
372
+ elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2
373
+ yum -y update
374
+ yum -y install curl
375
+ else
376
+ echo "Unknown package manager (tried apt-get, dnf, yum)" >&2
377
+ exit 1
378
+ fi
334
379
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
335
380
bash -s -- --embedded-wasm --flags="$BUILD_FLAGS" ${{ matrix.swift_version }}
336
381
0 commit comments