Skip to content

How to create prereleases for feature branches? #192

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

Open
wood-jp opened this issue Mar 26, 2025 · 0 comments
Open

How to create prereleases for feature branches? #192

wood-jp opened this issue Mar 26, 2025 · 0 comments

Comments

@wood-jp
Copy link

wood-jp commented Mar 26, 2025

I'm using the Github Action, but willing to try other things. Here's what I have now (note that develop is the default branch):

name: Release
on:
  workflow_dispatch:
  push:
    branches:
      - develop
      - feature/*

permissions:
  contents: read # for checkout

env:
  BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
  release:
    runs-on: ubuntu-latest
    name: Release
    if: ${{ github.ref == 'refs/heads/develop' }} # full release only on develop branch
    permissions:
      contents: write # to be able to publish a GitHub release
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Go
        uses: actions/setup-go@v3
        with:
          go-version: 1.24
      - name: Execute Release
        uses: go-semantic-release/action@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          force-bump-patch-version: true
          changelog-generator-opt: "emojis=true"
          prerelease: false

  pre-release:
    runs-on: ubuntu-latest
    name: Pre-Release
    if: ${{ github.ref != 'refs/heads/develop' }} # full release only on develop branch
    permissions:
      contents: write # to be able to publish a GitHub release
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Go
        uses: actions/setup-go@v3
        with:
          go-version: 1.24
      - name: Execute Release
        uses: go-semantic-release/action@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          force-bump-patch-version: true
          changelog-generator-opt: "emojis=true"
          prerelease: true # full release only on develop branch

And what I'm trying to accomplish is:

  1. A proper release should happen when a merge is done to the develop branch. This works as expected.
  2. A pre-release should happen when a merge is done to any branch named feature/*. I want the tag to be vX.X.X-yyy.Z where:
  • vX.X.X is the most recent full release tag on which the feature branch is based.
  • yyy is an alphanumeric string that I can pass (I would base this on the branch name).
  • Z is an auto-incrementing integer for each such prerelease.

I have played around with the custom-arguments passing --maintained-version of various kinds, but I am not having much success. Reading other issues has not been helpful either.

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