Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag project-x.y.z exists locally but has not been pushed #561

Open
gabsmprocha opened this issue Jul 6, 2022 · 11 comments
Open

tag project-x.y.z exists locally but has not been pushed #561

gabsmprocha opened this issue Jul 6, 2022 · 11 comments
Labels
bug Something isn't working

Comments

@gabsmprocha
Copy link

gabsmprocha commented Jul 6, 2022

Hi guys,

I'm having the same error similar to this issue: #461

error: tag project-x.y.z exists locally but has not been pushed

 "release": {
            "executor": "@jscutlery/semver:version",
            "options": {
                "push": true,
                "postTargets": ["project:github"]
            }
        },
  "github": {
      "executor": "@jscutlery/semver:github",
      "options": {
        "tag": "${tag}",
        "notesFile": "./apps/angular/project/CHANGELOG.md"
      }
  }
@shawnmclean
Copy link

I'm also getting this error, my error is here: https://github.com/Samelogic/microsurveys/runs/7366584884?check_suite_focus=true

@edbzn edbzn added the bug Something isn't working label Jul 16, 2022
@edbzn
Copy link
Member

edbzn commented Jul 16, 2022

Well, I think I fixed this bug multiple times without fixing it finally... 😱

@AndriiTsok
Copy link

We are experiencing the same issue. Seems like the Github action tries to create the same tag for Github release.

> nx run apps-corporate:version

[apps-corporate] 🟠 No previous version tag found, fallback to version 0.0.0.
        New version will be calculated based on all changes since first commit.
        If your project is already versioned, please tag the latest release commit with [email protected] and run this command again.
[apps-corporate] 🆕 Calculated new version "0.1.0".
[apps-corporate] 📜 Generated CHANGELOG.md.
[apps-corporate] 📦 Committed "chore(apps-corporate): release version 0.1.0".
[apps-corporate] 🔖 Tagged "[email protected]".
Error: tag [email protected] exists locally but has not been pushed to XXX/Monorepo, please push it before continuing or specify the `--target` flag to create a new tag

    at /home/runner/work/Monorepo/Monorepo/node_modules/@jscutlery/semver/src/executors/common/exec.js:10:34
    at ChildProcess.exithandler (node:child_process:406:5)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
[apps-corporate] ❌ Error: Something went wrong with post-target "apps-corporate:github".
    at /home/runner/work/Monorepo/Monorepo/node_modules/@jscutlery/semver/src/executors/version/utils/post-target.js:[22](https://github.com/XXX/Monorepo/runs/7928604381?check_suite_focus=true#step:6:23):[27](https://github.com/XXX/Monorepo/runs/7928604381?check_suite_focus=true#step:6:28)
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/Monorepo/Monorepo/node_modules/tslib/tslib.js:115:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@samuelfernandez
Copy link

Any news here?

@AndriiTsok
Copy link

@samuelfernandez setting "push": true in version scheme resolved the problem for us. The error happened because the tag was not pushed before creating Github Release. You can see it from the error message.

Make sure you removed all unwanted tags locally and remotely and run git fetch.

I can confirm that everything now works and @edbzn can close it.

@samuelfernandez
Copy link

@AndriiTsok that was a fast answer, thanks so much! Would it be useful to explain that in the readme and config examples for github builder?

lekhanhsinh added a commit to lekhanhsinh/lekhanhsinh-packages that referenced this issue Apr 3, 2023
@sschneider-ihre-pvs
Copy link

no idea if this works but nx run apps-corporate:version || exit 0 to brute force a positive exit code

@irfnkprc
Copy link

irfnkprc commented Jun 13, 2023

I am getting a similar error after successful deployment

"version": {
      "executor": "@jscutlery/semver:version",
      "options": {
        "preset": "conventional",
        "baseBranch": "main",
        "tagPrefix": "release/${projectName}@",
        "push": true,
        "commitMessageFormat": "release(${projectName}): version ${version} [skip ci]",
        "postTargets": ["my-project:deploy", "my-project:github"],
        "syncVersions": false,
        "trackDeps": true,
        "skipCommitTypes": ["docs", "ci", "release"]
      }
    },
    "github": {
      "executor": "@jscutlery/semver:github",
      "options": {
        "target": "main",
        "tag": "${tag}",
        "notes": "${notes}"
      }
    },
    "deploy": {
      "executor": "ngx-deploy-npm:deploy",
      "options": {
        "access": "restricted",
        "buildTarget": "production",
        "registry": "https://npm.pkg.github.com/"
      }
    }
🚀 Successfully published via ngx-deploy-npm! Have a nice day!
[my-project] 🎉 Ran post-target "my-project:deploy".
Error
    at /home/circleci/project/node_modules/@jscutlery/semver/src/executors/common/exec.js:10:34
    at exithandler (node:child_process:427:5)
    at ChildProcess.errorhandler (node:child_process:439:5)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[my-project] ❌ Error: Something went wrong with post-target "my-project:github".
    at /home/circleci/project/node_modules/@jscutlery/semver/src/executors/version/utils/post-target.js:25:31
    at Generator.next (<anonymous>)
    at fulfilled (/home/circleci/project/node_modules/tslib/tslib.js:164:62)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

@irfnkprc
Copy link

irfnkprc commented Jun 20, 2023

Finally i found the problem causing this error:
As stated here: @jscutlery/semver:github requires GitHub CLI to be installed.
I added installation steps for linuxbrew and Github CLI

Here is my working circleci config.yml

version: 2.1
orbs:
  node: circleci/[email protected]

# - - - - - - - -
# executors
# - - - - - - - -
executors:
  node-docker:
    docker:
      - image: cimg/node:18.15.0

# - - - - - - - -
# commands
# - - - - - - - -
commands:
  workspace-setup:
    steps:
      - checkout
      - attach_workspace:
          at: .
  login-to-npm-registry:
    steps:
      - run:
          name: 'login to npm registry'
          command: echo "//npm.pkg.github.com/:_authToken=$GITHUB_NPM_TOKEN" >> ~/.npmrc
  git-login:
    steps:
      - run:
          name: git login
          command: |
            git config --global user.email "[email protected]"
            git config --global user.name "xxx"
  install-linux-brew:
    steps:
      - run:
          name: Install and set Linuxbrew
          command: |
            sudo apt-get install build-essential curl file git
            sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

            echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin/:$PATH"' >> $BASH_ENV
            echo 'export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"' >> $BASH_ENV
            echo 'export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"' >> $BASH_ENV

# - - - - - - - -
# jobs
# - - - - - - - -

jobs:
  npm-init:
    executor: node-docker
    steps:
      - checkout
      - node/install-packages:
          app-dir: '.'
          with-cache: false
      - persist_to_workspace:
          root: .
          paths:
            - .npm/
            - node_modules/

  unit-test:
    executor: node-docker
    steps:
      - workspace-setup
      - run:
          name: Run Unit Tests
          command: npx nx run my-project:test --configuration=ci

  publish-package:
    executor: node-docker
    steps:
      - workspace-setup
      - login-to-npm-registry
      - git-login
      - install-linux-brew
      - run:
          name: Install Github CLI
          command: brew install gh
      - run:
          name: publish package
          command: npx nx run my-project:version

  publish-beta-package-dev:
    executor: node-docker
    steps:
      - workspace-setup
      - login-to-npm-registry
      - git-login
      - run:
          name: publish beta package dev
          command: npx nx run my-project:beta-release

# - - - - - - - -
# workflows
# - - - - - - - -

workflows:
  version: 2

  verify:
    jobs:
      - npm-init
      - unit-test:
          requires:
            - npm-init
          context:
            - NPM
      - publish-package:
          filters:
            branches:
              only:
                - main
          requires:
            - unit-test
          context:
            - NPM
      - publish-beta-package-dev:
          filters:
            branches:
              only:
                - dev
          requires:
            - unit-test
          context:
            - NPM

@dannyfranca
Copy link

@gabsmprocha This error means your tags were not pushed to the remote. It does not automatically goes with git push.

First, you have to create your tag with git tag project-x.y.z and then send it with git push --tags.

Then your Github will be in sync with your remote tags and the semver will be able to infer your correct version.

@luber
Copy link

luber commented Jan 3, 2024

Finally i found the problem causing this error: As stated here: @jscutlery/semver:github requires GitHub CLI to be installed. I added installation steps for linuxbrew and Github CLI

Here is my working circleci config.yml

version: 2.1
orbs:
  node: circleci/[email protected]

# - - - - - - - -
# executors
# - - - - - - - -
executors:
  node-docker:
    docker:
      - image: cimg/node:18.15.0

# - - - - - - - -
# commands
# - - - - - - - -
commands:
  workspace-setup:
    steps:
      - checkout
      - attach_workspace:
          at: .
  login-to-npm-registry:
    steps:
      - run:
          name: 'login to npm registry'
          command: echo "//npm.pkg.github.com/:_authToken=$GITHUB_NPM_TOKEN" >> ~/.npmrc
  git-login:
    steps:
      - run:
          name: git login
          command: |
            git config --global user.email "[email protected]"
            git config --global user.name "xxx"
  install-linux-brew:
    steps:
      - run:
          name: Install and set Linuxbrew
          command: |
            sudo apt-get install build-essential curl file git
            sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

            echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin/:$PATH"' >> $BASH_ENV
            echo 'export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"' >> $BASH_ENV
            echo 'export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"' >> $BASH_ENV

# - - - - - - - -
# jobs
# - - - - - - - -

jobs:
  npm-init:
    executor: node-docker
    steps:
      - checkout
      - node/install-packages:
          app-dir: '.'
          with-cache: false
      - persist_to_workspace:
          root: .
          paths:
            - .npm/
            - node_modules/

  unit-test:
    executor: node-docker
    steps:
      - workspace-setup
      - run:
          name: Run Unit Tests
          command: npx nx run my-project:test --configuration=ci

  publish-package:
    executor: node-docker
    steps:
      - workspace-setup
      - login-to-npm-registry
      - git-login
      - install-linux-brew
      - run:
          name: Install Github CLI
          command: brew install gh
      - run:
          name: publish package
          command: npx nx run my-project:version

  publish-beta-package-dev:
    executor: node-docker
    steps:
      - workspace-setup
      - login-to-npm-registry
      - git-login
      - run:
          name: publish beta package dev
          command: npx nx run my-project:beta-release

# - - - - - - - -
# workflows
# - - - - - - - -

workflows:
  version: 2

  verify:
    jobs:
      - npm-init
      - unit-test:
          requires:
            - npm-init
          context:
            - NPM
      - publish-package:
          filters:
            branches:
              only:
                - main
          requires:
            - unit-test
          context:
            - NPM
      - publish-beta-package-dev:
          filters:
            branches:
              only:
                - dev
          requires:
            - unit-test
          context:
            - NPM

well, GitHub CLI is preinstalled on all GitHub-hosted runners:
https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants