@@ -15,17 +15,7 @@ permissions:
15
15
jobs :
16
16
tag :
17
17
runs-on : ubuntu-latest
18
- outputs :
19
- tag : ${{ steps.version.outputs.tag }}
20
18
steps :
21
- - name : Check if github trigger is schedule or pr or tag
22
- id : version
23
- run : |
24
- if [ "${{ github.event_name }}" = "schedule" ]; then
25
- echo "tag=nightly" >> $GITHUB_OUTPUT
26
- elif [ ${{ startsWith(github.ref, 'refs/tags/') }} = true ]; then
27
- echo "tag=${{ basename(github.ref) }}" >> $GITHUB_OUTPUT
28
- fi
29
19
- name : Update Nightly Tag
30
20
if : github.event_name == 'schedule'
31
21
uses : richardsimko/update-tag@v1
@@ -40,17 +30,17 @@ jobs:
40
30
if : startsWith(github.ref, 'refs/tags/') == true
41
31
run : |
42
32
cd crates/bins/wick
43
- if grep -q "version = ' ${{ env.GITHUB_REF }}' " Cargo.toml; then
33
+ if grep -q "version = \" ${{ env.GITHUB_REF }}\" " Cargo.toml; then
44
34
echo "Match found!"
45
35
else
46
36
echo "No match found."
47
37
exit 1
48
38
fi
49
39
env :
50
- GITHUB_REF : ${{ github.ref }}
40
+ GITHUB_REF : ${{ github.ref_name }}
51
41
test :
52
42
needs : tag
53
- if : github.event_name != 'push'
43
+ if : github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/') == true
54
44
runs-on : ${{ matrix.config.os }}
55
45
env :
56
46
SCCACHE_AZURE_BLOB_CONTAINER : ${{ secrets.SCCACHE_AZURE_BLOB_CONTAINER }}
@@ -304,7 +294,7 @@ jobs:
304
294
7z a -tzip wick-${{ matrix.config.name }}-${{ matrix.config.arch }}.zip README.md LICENSE wick.exe
305
295
- name : Upload artifacts (windows)
306
296
if : matrix.config.target == 'x86_64-pc-windows-gnu'
307
- uses : actions/upload-artifact@v2
297
+ uses : actions/upload-artifact@v3
308
298
with :
309
299
name : wick-${{ matrix.config.name }}-${{ matrix.config.arch }}.zip
310
300
path : _dist/wick-${{ matrix.config.name }}-${{ matrix.config.arch }}.zip
@@ -316,44 +306,37 @@ jobs:
316
306
- uses : actions/checkout@v3
317
307
- name : Install jq
318
308
run : sudo apt-get install -y jq
319
- - name : Download artifacts into a single directory
320
- env :
321
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
309
+ - name : Download artifacts
310
+ uses : actions/download-artifact@v3
311
+ with :
312
+ path : artifacts
313
+ - name : Move artifacts to _dist
322
314
working-directory : ${{ github.workspace }}
323
315
run : |
324
316
mkdir -p _dist
325
- ARTIFACTS_URL=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" https://api.github.com/repos/candlecorp/wick/actions/runs/4485720507/artifacts | jq -r '.artifacts[].archive_download_url')
326
-
327
- # Print the URLs of the artifacts
328
- echo "Downloading artifacts from the following URLs:"
329
- echo "$ARTIFACTS_URL"
330
-
331
- for url in $ARTIFACTS_URL; do
332
- curl -L -H "Authorization: token $GITHUB_TOKEN" $url -o artifact.zip
333
-
334
- echo "Downloaded artifact:"
335
- ls -la artifact.zip
336
-
337
- # Print the contents of the downloaded archive file
338
- echo "Contents of artifact.zip:"
339
- unzip -l artifact.zip
340
-
341
- unzip -j artifact.zip -d _dist
342
- rm artifact.zip
317
+ for dir in artifacts/*/; do
318
+ # Move the contents of each directory to the destination folder
319
+ echo "Moving {$dir}"
320
+ mv "$dir"* _dist/
343
321
done
344
-
345
322
#Copy the schema manifest into the dist directory
346
323
cp crates/wick/wick-config/json-schema/manifest.json _dist/schema.json
347
-
348
- # Print the contents of the _dist directory
349
- echo "Contents of _dist directory:"
350
324
ls -la _dist
351
- - name : upload release assets
325
+ - name : upload release assets (tag)
352
326
uses : svenstaro/upload-release-action@v2
327
+ if : startsWith(github.ref, 'refs/tags/') == true
353
328
with :
354
329
repo_token : ${{ secrets.GITHUB_TOKEN }}
355
330
file : _dist/*
356
- tag : ${{ needs.tag.outputs.tag }}
331
+ tag : ${{ github.ref }}
332
+ overwrite : true
333
+ file_glob : true
334
+ - name : upload release assets (nightly)
335
+ uses : svenstaro/upload-release-action@v2
336
+ with :
337
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
338
+ file : _dist/*
339
+ tag : nightly
357
340
overwrite : true
358
341
file_glob : true
359
342
- name : ghcr login
@@ -368,7 +351,6 @@ jobs:
368
351
uses : docker/setup-buildx-action@v1
369
352
- name : build and push
370
353
uses : docker/build-push-action@v2
371
- if : ${{ needs.tag.outputs.tag }} == 'nightly'
372
354
with :
373
355
context : .
374
356
file : ./docker/Dockerfile.nightly
@@ -377,10 +359,10 @@ jobs:
377
359
platforms : linux/amd64,linux/arm64
378
360
- name : build and push
379
361
uses : docker/build-push-action@v2
380
- if : github.event_name == 'workflow_dispatch'
362
+ if : startsWith( github.ref, 'refs/tags/') == true
381
363
with :
382
364
context : .
383
365
file : ./docker/Dockerfile.latest
384
366
push : true
385
- tags : ghcr.io/candlecorp/wick:latest, ghcr.io/candlecorp/wick:${{ inputs.version }}
367
+ tags : ghcr.io/candlecorp/wick:latest, ghcr.io/candlecorp/wick:${{ github.ref_name }}
386
368
platforms : linux/amd64,linux/arm64
0 commit comments