Tag filtering specifics

For reference, here is my config

version: 2

defaults: &defaults
  working_directory: ~/AsyncAF
  docker:
    - image: circleci/node:latest

jobs:
  test:
    <<: *defaults
    steps:
      - checkout
      - restore_cache:
          keys:
            - v3-dependencies-{{ checksum "package-lock.json" }}
            - v3-dependencies-
      - run:
          name: updating npm...
          command: npmv=$(echo $(npm -v) | head -c 1); if [ "$npmv" -lt "6" ]; then sudo npm i -g npm; else echo "Node.js Docker Team finally decided to include npm v6+ in latest image; you can remove this script now"; fi
      - run:
          name: installing dev dependencies...
          command: npm ci
      - save_cache:
          key: v3-dependencies-{{ checksum "package-lock.json" }}
          paths:
              - node_modules
      - run:
          name: checking coverage...
          command: npm run cover
      - run:
          name: reporting to codecov...
          command: bash <(curl -s https://codecov.io/bash)
      - run:
          name: linting...
          command: npm run lint
      - run:
          name: testing modern & legacy packages...
          command: npm run test:built
      - persist_to_workspace:
          root: ~/AsyncAF
          paths:
            - ./circleci/*
            - ./package.json
            - ./package-lock.json
            - ./node_modules/*
            - ./dist/*
            - ./.npmrc
            - ./lerna.json
  publish:
    <<: *defaults
    steps:
      - attach_workspace:
          at: ~/AsyncAF
      - run:
          name: authenticating with npm registry...
          command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
      - run:
          name: publishing all packages...
          command: npm run release

workflows:
  version: 2
  test-publish:
    jobs:
      - test:
          filters:
            tags:
              only: /.*/
      - publish:
          requires:
            - test
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+($|-prerelease\.\d+$)/
            branches:
                ignore: /.*/

Currently, the publish workflow runs when I manually run

  • npm version patch
  • git push upstream master --tags

Now, I’m working with Renovate to automate this so I can publish a new version to npm whenever Renovate updates dependencies. (See this github issue for details.)

In order to help Renovate’s author with this feature I’d like to ask a couple questions on how CircleCI picks up tags:

  • npm version patch adds a commit (e.g., 1.0.1 and tags it v1.0.1). CircleCI would pick up the tag even if it wasn’t attached to that commit, but rather another commit with an arbitrary commit message like chore(deps): update dependency browserslist to ^4.3.5, right? (I’m pretty sure the answer is yes.)

  • I’m able to get CircleCI to trigger the workflow with git push upstream master --tags, but would the workflow also be triggered if the tag were added via the github API?

Thanks!

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