Skip to content

Commit e2150c7

Browse files
author
Daniele Briggi
committed
fix(workflow): trigger after the build and release workflow
1 parent 9981f61 commit e2150c7

3 files changed

Lines changed: 54 additions & 60 deletions

File tree

.github/workflows/main.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Test
1+
name: Build, Test and Release
22
on:
33
push:
44
workflow_dispatch:
@@ -358,3 +358,55 @@ jobs:
358358
name: ai-${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }}
359359
path: dist/ai.*
360360
if-no-files-found: error
361+
362+
release:
363+
runs-on: ubuntu-22.04
364+
name: release
365+
needs: build
366+
if: github.ref == 'refs/heads/main'
367+
368+
steps:
369+
370+
- uses: actions/checkout@v4.2.2
371+
372+
- uses: actions/download-artifact@v4.2.1
373+
with:
374+
path: artifacts
375+
376+
- name: release tag version from sqlite-ai.h
377+
id: tag
378+
run: |
379+
VERSION=$(make version)
380+
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
381+
LATEST=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.name')
382+
if [[ "$VERSION" != "$LATEST" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
383+
echo "version=$VERSION" >> $GITHUB_OUTPUT
384+
else
385+
echo "::warning file=src/sqlite-ai.h::To release a new version, please update the SQLITE_AI_VERSION in src/sqlite-ai.h to be different than the latest $LATEST"
386+
fi
387+
exit 0
388+
fi
389+
echo "❌ SQLITE_AI_VERSION not found in sqlite-ai.h"
390+
exit 1
391+
392+
- name: zip artifacts
393+
run: |
394+
for folder in "artifacts"/*; do
395+
if [ -d "$folder" ]; then
396+
name=$(basename "$folder")
397+
if [[ "$name" != "ai-apple-xcframework" ]]; then
398+
tar -czf "${name}-${{ steps.tag.outputs.version }}.tar.gz" -C "$folder" .
399+
fi
400+
(cd "$folder" && zip -rq "../../${name}-${{ steps.tag.outputs.version }}.zip" .)
401+
fi
402+
done
403+
404+
- uses: softprops/action-gh-release@v2.2.1
405+
if: steps.tag.outputs.version != ''
406+
with:
407+
generate_release_notes: true
408+
tag_name: ${{ steps.tag.outputs.version }}
409+
files: |
410+
ai-*-${{ steps.tag.outputs.version }}.zip
411+
ai-*-${{ steps.tag.outputs.version }}.tar.gz
412+
make_latest: true

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99
type: string
1010
workflow_run:
11-
workflows: ["Release"]
11+
workflows: ["Build, Test and Release"]
1212
types:
1313
- completed
1414

.github/workflows/release.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)