diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 0bf9b11..41ff399 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,8 +1,9 @@ name: Publish to PyPI on: - release: - types: [published] + workflow_run: + workflows: ["Release"] + types: [completed] workflow_dispatch: inputs: tag: @@ -14,7 +15,11 @@ jobs: publish: name: Publish to PyPI runs-on: ubuntu-latest - if: github.repository == '35C4n0r/langgraph-ephemeral-checkpointer' + if: | + github.repository == '35C4n0r/langgraph-ephemeral-checkpointer' && ( + github.event_name == 'workflow_dispatch' || + github.event.workflow_run.conclusion == 'success' + ) environment: name: pypi url: https://pypi.org/project/langgraph-ephemeral-checkpointer/ @@ -24,8 +29,17 @@ jobs: contents: read steps: + - name: Resolve tag + id: tag + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "value=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" + else + echo "value=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT" + fi + - name: Download release assets - run: gh release download ${{ github.event.release.tag_name || inputs.tag }} --dir dist/ --repo ${{ github.repository }} + run: gh release download ${{ steps.tag.outputs.value }} --dir dist/ --repo ${{ github.repository }} env: GH_TOKEN: ${{ github.token }}