Workflow is not triggered by tag push on Github

Hello everyone !

I know this issue has been mentioned in a lot of topics but unfortunately I haven’t found a solution in any of them.
I’ve configured my circleci.yml to publish my npm package when a new tag is created but circleci does not seem to detect it.

Here is my configuration:

version: 2.1

defaults: &defaults
  working_directory: ~/repo
  docker:
    - image: circleci/node:12.14.1

orbs:
  codecov: codecov/codecov@1.0.5
jobs:
  build:
    <<: *defaults

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: yarn install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run: yarn test

      - codecov/upload:
        file: {{ coverage_report_filepath }}
  deploy:
    <<: *defaults
    steps:
      - attach_workspace:
          at: ~/repo
      - run:
          name: Authenticate with registry
          command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
      - run:
          name: Publish package
          command: yarn release

workflows:
  version: 2
  build-and-deploy:
    jobs:
      - build:
        filters:
          tags:
            only: /.*/
      - deploy:
          requires:
            - build
          filters:
            tags:
              only: /^\d+\.\d+\.\d+(-pre\.\d+)?$/
            branches:
              ignore: /.*/

To add more informations, the repo is hosted on github and the tag I pushed was the following: 0.0.1-pre.1

I’m running out of options so, I one of you could find out the solution it would be great !

Thank you in advance !

I’m gonna piggyback on to this thread, as I have a similar/the same problem, I am overall confused by the documentation on this feature.

For example, my current config looks like this (workflow only) — but release is triggered each time:

workflows:
  pr:
    jobs:
      - test
      - build:
          requires:
            - test
      - integration:
          requires:
            - build
  release:
    jobs:
      - test:
          filters:
            tags:
              only: /^v.*/
      - release:
          requires:
            - test
          filters:
            tags:
              only: /^v.*/

@TheHumbleJester Welcome to CircleCI Discuss!

It appears the spacing on the build job definition inside the build-and-deploy workflow is a little off. I was able to trigger a job using variations of the tag 1.1.1-pre.1 after fixing the spacing.

workflows:
  version: 2
  build-and-deploy:
    jobs:
      - build:
          filters:
            tags:
              only: /.*/
      - deploy:
          requires:
            - build
          filters:
            tags:
              only: /^\d+\.\d+\.\d+(-pre\.\d+)?$/
            branches:
              ignore: /.*/

Hey @till

The release job will run each commit unless you explicitly tell it to ignore branches. Check the below example!

- release:
    requires:
      - test
    filters:
      tags:
        only: /^v.*/
      branches:
        ignore: /.*/
1 Like

I feel so stupid right now ! :sweat_smile:
Thank you so much for pointing the issue !

No worries, we can all use a second set of eyes occasionally!

Happy building!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.