Code Monkey home page Code Monkey logo

semver-tags's People

Contributors

dependabot[bot] avatar gislikonrad avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

semver-tags's Issues

Bug: latest (1.5.3) cannot tag when a previous tag does not exist

It seems if this action has to generate a default tag it fails

Run SOLIDSoftworks/[email protected]
Generating version regex pattern
Generated pattern: ^hatch-test-suite-v(\d+)\.(\d+)\.(\d+)(-(\w[\w.]*))?(\+(\w[\w\.]*))??$
Getting previous tags
Generating version regex pattern
Generated pattern: ^hatch-test-suite-v?(\d+)\.(\d+)\.(\d+)(-(\w[\w.]*))?(\+(\w[\w\.]*))??$
No previous version tag. Using '0.1.0' as next version.
/runner/_work/_actions/SOLIDSoftworks/semver-tags/v1.5.3/dist/index.js:27572
    major = match[1];
                 ^

TypeError: Cannot read properties of null (reading '1')
    at calculateNextVersion (/runner/_work/_actions/SOLIDSoftworks/semver-tags/v1.5.3/dist/index.js:27572:18)
    at run (/runner/_work/_actions/SOLIDSoftworks/semver-tags/v1.5.3/dist/index.js:27685:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

My guess is that the match is not being populated, possibly because prefix optional=true being ignored:

const versionPattern = generateVersionPattern({ tagPrefix: tagPrefix, tagPrefixOptional: true });

Usage in question:

      - name: Bump version and push tag
        uses: SOLIDSoftworks/[email protected]
        id: tag_version
        with:
          GITHUB_TOKEN: ${{ steps.secrets.outputs.GITHUB_TOKEN }}
          tag-prefix: ${{ matrix.workflows }}-v
          default-version: '0.1.0'
          incremented-value: ${{ steps.bump_version.outputs.value }}
          dry-run: ${{ github.event_name == 'pull_request' }}

define prerelease based on branch

Hi! Great work! Your GitHub action helped me a lot.

Still, I'm trying to implement a workflow where all pushes outside of main branch create ...-alpha tags and pushes to main branch creates the usual semver tag.

What I tried:

env:
  PRERELEASE: false

jobs:
    self_tag:
      runs-on: ubuntu-latest
      steps:
        - name: Checkout
          uses: actions/checkout@v3

        - name: add prerelease variable
          if: ${{ github.ref != 'refs/heads/main' }}
          run: echo "PRERELEASE=alpha" >> $GITHUB_ENV

        - name: add tag
          uses: SOLIDSoftworks/semver-tags@v1
          with:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
            tag-prefix: 'v'
            default-version: '1.0.0'
            prerelease: ${{ env.PRERELEASE }}
            create-release: main
            add-minor-tag: true
            add-major-tag: true

Github Action Stdout is

Run SOLIDSoftworks/semver-tags@v1
  with:
    GITHUB_TOKEN: ***
    tag-prefix: v
    default-version: 1.0.0
    prerelease: false
    create-release: main
    add-minor-tag: true
    add-major-tag: true
    incremented-value: patch
    dry-run: false
  env:
    PRERELEASE: false
....
....
Creating new release tag: v1.0.2-false
Release is a prerelease. Skipping major tag...
Release is a prerelease. Skipping minor tag...

and if I removing

env:
  PRERELEASE: false

then stdout is:

  with:
    GITHUB_TOKEN: ***
    tag-prefix: v
    default-version: 1.0.0
    prerelease: $
    add-minor-tag: true
    add-major-tag: true
    incremented-value: patch
    create-release: main
    dry-run: false
...
...
Creating new release tag: v1.0.1-$
Release is a prerelease. Skipping major tag...
Release is a prerelease. Skipping minor tag...

For now, I have two steps in the same workflow, wich only differs by if condition based on the branch. Still, it will be nice to have the ability to specify prerelease tags based on the branch.

I can create a PR, but there are a few options on how it can be implemented, and I want to discuss it with you first.

Possible implementation:

  1. updating if(prerelease) in the code to check if string is false
  2. updating prerelease variable with logic you had in create-release variable
  3. create prerelease if create-release didn't contain valid branch

wdyt?

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.