How to make circleci only be trigger when I create a new release?

I just want to let circleci compile Linux aarch64 part for me (others are compiled in github actions).

And I only want to trigger it, when I create a new release. However, it is trigger every time I push a commit.

version: 2.1

jobs:
  linux-aarch64-wheels:
    working_directory: ~/linux-aarch64-wheels
    machine:
      image: ubuntu-2004:2022.04.1
    resource_class: arm.medium
    steps:
      - checkout
      - run:
          name: Build the Linux aarch64 wheels.
          command: |
            git submodule init
            git submodule update --remote
            python3 -m pip install --user cibuildwheel twine
            python3 -m cibuildwheel --output-dir wheelhouse
            twine upload -r testpypi wheelhouse/*
      - store_artifacts:
          path: wheelhouse/

workflows:
  version: 2
  build-wheel:
    jobs:
      - linux-aarch64-wheels

You set a condition on the workflow

In my environments, I check for tags in a known format that cause the build to take place and define the environment to deploy too.

You can do something like this:

  filters:
    tags:
      only: /^v\d+\.\d+\.\d+/
    branches:
      ignore: /.*/

(assuming your tag looks like v10.5.3; adjust the regex as needed).

Note that if you are filtering one job in a given workflow, and you have other jobs in that workflow, you may need to add filters on the other jobs as well.

You can, however, have a completely separate workflow for releases, which might be simpler.

@Yikai-Liao,

Another approach would be to configure the CircleCI webhook in the repository settings to only trigger a delivery when a release is created, edited, published, unpublished, or deleted.

To get this behaviour, you’d need to:

  1. Select the Releases event
  2. Disable all other events