Coder Social home page Coder Social logo

action-detect-and-tag-new-version's People

Contributors

dependabot[bot] avatar dfreeman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

action-detect-and-tag-new-version's Issues

Cant get blank tag-annotation-template to work

I have tag-annotation-template: '' and it is just ignored and the default is used. I know im doing it right because if i have anything in the string it works.

let annotationTemplate = getInput('tag-annotation-template') || 'Released version {VERSION}';

this line is whats causing the problem when getInput('tag-annotation-template') is blank its considered false and just defaults to
Released version {VERSION} so there's no way to not have an annotation

my current workaround is to just use v1.0.3 which doesn't have annotations at all
uses: salsify/[email protected]

personally i think you should just change it to

let annotationTemplate = getInput('tag-annotation-template') || '';

and let the default operation have no annotation and let users add an annotation if they want by specifying tag-annotation-template

File not found /dist/index.js

I am using the action in conjunction with poetry like so:

      - name: Detect and tag new version
        id: check-version
        if: steps.check-parent-commit.outputs.sha
        uses: salsify/action-detect-and-tag-new-version@624bb847c54529c8c4175cb36b534b101daae484
        with:
          version-command: |
            bash -o pipefail -c "poetry version | awk '{ print \$2 }'"

I doubt that it has to do with the version-command as the error message is:

File not found: '/home/runner/work/_actions/salsify/action-detect-and-tag-new-version/624bb847c54529c8c4175cb36b534b101daae484/dist/index.js'

add support for pubspec.yaml

I'm suggesting a default value for version-command, in case a pubspec.yaml file (Flutter) is found:

grep "version\: " ./pubspec.yaml | sed 's/version\: //g'

I've just checked that this works on my flutter repository.
I don't guarantee it's 100% fault proof, pretty sure it's better than nothing.

Command failed with exit code 128

The action can't create a tag because of a fatal error of "fatal: unable to access 'repo_url': The requested URL returned error: 403". Probably because it's a private repo?

Action wouldn't work in workflow triggered by pull request

Hi, we've came across this action recently and it does exactly what we need. Thank you for sharing.

That being said there is one scenario in which the action wouldn't work. Here's how you could reproduce it. Please disregard version-command that doesn't make sense, it's just for testing purposes.

.github/workflows/tag.yml

name: tag-argocd

on:
  pull_request:
    branches:
      - argocd

jobs:
  tag:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: salsify/[email protected]
        with:
          create-tag: false
          version-command: |
            echo "123"

This workflow always result in failure.

Run salsify/[email protected]
  with:
    create-tag: false
    version-command: echo "123"
  
    tag-template: v{VERSION}
    tag-annotation-template: Released version {VERSION}
Previous version: 123
Error: Command failed with exit code 1: git checkout refs/pull/18/merge
error: pathspec 'refs/pull/18/merge' did not match any file(s) known to git

Would you have any advice how to fix that?

Command failed with exit code 1: git checkout refs/pull/3/merge

Here is my .github/workflows/ci.yml:

name: CI

on:
  pull_request:
    branches: [ "main" ]

jobs:
  linux-ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 2 # https://github.com/marketplace/actions/detect-and-tag-new-version#usage
      - uses: salsify/action-detect-and-tag-new-version@v2 # https://github.com/marketplace/actions/detect-and-tag-new-version#usage
        with:
          version-command: |
            yq '.version' pubspec.yaml

When I run it in github I got error Error: Command failed with exit code 1: git checkout refs/pull/3/merge

image

What am I missing here ?

In pubspec.yaml I got:

# ...
version: 0.0.1+3
# ...

Feature: Allow generating "development releases" if no new version detected

We frequently use this repo and then pair it with a not-tiny follow up bash script to do the following logic:

  1. If this is a new version (different than prior commit and no existing tag) then set variable prod_build to true.
  2. Else increment to desired semantic version number (should be configurable but we just hard code it per branch) and then add -dev.$CURRENT_COMMIT to the end of it.

I wanted to see if there was interest in this repo supporting some or all of this logic as I've used it across dozens of projects and it's so templated at this point as to seem worth adding into the project itself if others find it useful.

      - name: Version pre-release
        id: gen_version
        run: |
          set -ex
          previous_version="${{steps.detect_version.outputs.previous-version}}"
          current_version="${{steps.detect_version.outputs.current-version}}"
          current_version_existing_tag="$(git ls-remote --tags origin | cut -d$'\t' -f2 | grep "^refs/tags/${current_version}$" || true)"

          # If the version hasn't changed or if the version has already been released then it's a dev build
          if [ "$previous_version" = "$current_version" ] || [ "refs/tags/$current_version" = "$current_version_existing_tag" ]; then
            echo "Version has NOT changed. This is a dev build."
            export CURRENT_COMMIT="$(git rev-parse --short HEAD)"
            export NEW_PACKAGE_VERSION="$(npx semver --increment minor "$current_version")-dev.$CURRENT_COMMIT"
            echo "::set-output name=new_version::$NEW_PACKAGE_VERSION"
            echo "::set-output name=prod_build::false"
            echo "::set-output name=npm_tag::dev"
          else
            echo "Version has changed. This is a prod build!"
            echo "::set-output name=new_version::$current_version"
            echo "::set-output name=prod_build::true"
            echo "::set-output name=npm_tag::latest"
          fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.