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

define prerelease based on branch #5

Open
ctrlok opened this issue Dec 27, 2022 · 0 comments
Open

define prerelease based on branch #5

ctrlok opened this issue Dec 27, 2022 · 0 comments

Comments

@ctrlok
Copy link

ctrlok commented Dec 27, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant