diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7bfa165..3e1f70a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Build, Test and Release SQLite AI +name: Build, Test and Release on: push: workflow_dispatch: diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 58e8f52..e78eb1f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -7,14 +7,19 @@ on: description: "Version to use for the Python package (e.g. 0.5.9)" required: true type: string - release: - types: [released] + workflow_run: + workflows: ["Build, Test and Release"] + types: + - completed jobs: build-and-publish: + if: | + github.event_name == 'workflow_dispatch' || + (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') runs-on: ${{ matrix.os }} permissions: - id-token: write # mandatory for Pypi trusted publishing + id-token: write # mandatory for Pypi trusted publishing strategy: matrix: include: @@ -42,7 +47,7 @@ jobs: platform: macos python-version: "3.10" arch: arm64 - plat_name: macosx_11_0_arm64 + plat_name: macosx_11_0_arm64 defaults: run: shell: bash @@ -65,8 +70,9 @@ jobs: - name: Get version id: get_version run: | - if [[ "${{ github.event_name }}" == "release" ]]; then - VERSION="${{ github.event.release.tag_name }}" + if [[ "${{ github.event_name }}" == "workflow_run" ]]; then + # Fetch latest published release tag from GitHub API + VERSION=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name') else VERSION="${{ github.event.inputs.version }}" fi