Skip to content

Commit 3efb7eb

Browse files
authored
ci: working end-to-end tag (#173)
1 parent b61ade7 commit 3efb7eb

File tree

1 file changed

+26
-44
lines changed

1 file changed

+26
-44
lines changed

.github/workflows/mono_workflow.yaml

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,7 @@ permissions:
1515
jobs:
1616
tag:
1717
runs-on: ubuntu-latest
18-
outputs:
19-
tag: ${{ steps.version.outputs.tag }}
2018
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
2919
- name: Update Nightly Tag
3020
if: github.event_name == 'schedule'
3121
uses: richardsimko/update-tag@v1
@@ -40,17 +30,17 @@ jobs:
4030
if: startsWith(github.ref, 'refs/tags/') == true
4131
run: |
4232
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
4434
echo "Match found!"
4535
else
4636
echo "No match found."
4737
exit 1
4838
fi
4939
env:
50-
GITHUB_REF: ${{ github.ref }}
40+
GITHUB_REF: ${{ github.ref_name }}
5141
test:
5242
needs: tag
53-
if: github.event_name != 'push'
43+
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/') == true
5444
runs-on: ${{ matrix.config.os }}
5545
env:
5646
SCCACHE_AZURE_BLOB_CONTAINER: ${{ secrets.SCCACHE_AZURE_BLOB_CONTAINER }}
@@ -304,7 +294,7 @@ jobs:
304294
7z a -tzip wick-${{ matrix.config.name }}-${{ matrix.config.arch }}.zip README.md LICENSE wick.exe
305295
- name: Upload artifacts (windows)
306296
if: matrix.config.target == 'x86_64-pc-windows-gnu'
307-
uses: actions/upload-artifact@v2
297+
uses: actions/upload-artifact@v3
308298
with:
309299
name: wick-${{ matrix.config.name }}-${{ matrix.config.arch }}.zip
310300
path: _dist/wick-${{ matrix.config.name }}-${{ matrix.config.arch }}.zip
@@ -316,44 +306,37 @@ jobs:
316306
- uses: actions/checkout@v3
317307
- name: Install jq
318308
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
322314
working-directory: ${{ github.workspace }}
323315
run: |
324316
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/
343321
done
344-
345322
#Copy the schema manifest into the dist directory
346323
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:"
350324
ls -la _dist
351-
- name: upload release assets
325+
- name: upload release assets (tag)
352326
uses: svenstaro/upload-release-action@v2
327+
if: startsWith(github.ref, 'refs/tags/') == true
353328
with:
354329
repo_token: ${{ secrets.GITHUB_TOKEN }}
355330
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
357340
overwrite: true
358341
file_glob: true
359342
- name: ghcr login
@@ -368,7 +351,6 @@ jobs:
368351
uses: docker/setup-buildx-action@v1
369352
- name: build and push
370353
uses: docker/build-push-action@v2
371-
if: ${{ needs.tag.outputs.tag }} == 'nightly'
372354
with:
373355
context: .
374356
file: ./docker/Dockerfile.nightly
@@ -377,10 +359,10 @@ jobs:
377359
platforms: linux/amd64,linux/arm64
378360
- name: build and push
379361
uses: docker/build-push-action@v2
380-
if: github.event_name == 'workflow_dispatch'
362+
if: startsWith(github.ref, 'refs/tags/') == true
381363
with:
382364
context: .
383365
file: ./docker/Dockerfile.latest
384366
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 }}
386368
platforms: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)