diff --git a/.github/actions/cargo-publish/action.yml b/.github/actions/cargo-publish/action.yml index d55d1d59e..c32cb78c6 100644 --- a/.github/actions/cargo-publish/action.yml +++ b/.github/actions/cargo-publish/action.yml @@ -27,8 +27,12 @@ runs: ${{ runner.temp }}/artifacts - name: Log into crates.io - if: github.event_name != 'pull_request' && github.event_name != 'merge_group' && github.event_name != 'issue_comment' - run: cargo login -- ${{ inputs.cargo-registry-token }} + if: > + github.event_name == 'push' && ( + github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || + startsWith(github.ref, 'refs/tags/v') + ) + run: cargo login ${{ inputs.cargo-registry-token }} shell: bash - run: gh release delete --yes Unreleased || exit 0