I have this setup, in GitHub.
Main –> Release –> Feature/*
so, developer will develop features in feature branch using semantic versioning action cycjimmy/semantic-release-action@v4
which will create a package using -next.1
before introducing this way of working we always use Release as a Pre-Prd tag and test in UAT environment with Tag X.X.X. So, now if I introduce feature way of working, Github action is complaining tag 1.0.0 already exists while it should create a tag vX.X.X-next.1 .
So does anybody knows how to fix this? I’m committing the feature change as feat
.releaserc file:
{
"branches": [
{
"name": "main"
},
{
"name": "release",
"channel": "release",
"prerelease": "release"
},
{
"name": "feature/*",
"prerelease": "next",
"channel": "next"
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
]
}
],
"@semantic-release/github"
]
}
and my workflow file build.yaml looks like this
name: Build Pre-release CI
on:
push:
branches:
- feature/test
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Run Semantic Release for Feature
id: semantic_release_feature
uses: cycjimmy/semantic-release-action@v4
with:
branch: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Extract release version from tag
id: get_version
run: |
RELEASE_VERSION=${{ steps.semantic_release_feature.outputs.new_release_version }}
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Run Python tests
run: |
python -m unittest discover
- name: Update setup.py version
run: |
sed -i "s/version='.*'/version='${{ env.RELEASE_VERSION }}'/" setup.py
cat setup.py
- name: Commit version update
run: |
git config --global user.email "[email protected]"
git config --global user.name "ci-bot"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git add setup.py
git commit -m "chore(release): bump version to ${{ env.RELEASE_VERSION }}"
git push origin ${{ github.ref_name }}