diff --git a/.github/workflows/test-and-version.yml b/.github/workflows/test-and-version.yml index aae2e84..7a3dd84 100644 --- a/.github/workflows/test-and-version.yml +++ b/.github/workflows/test-and-version.yml @@ -23,7 +23,6 @@ jobs: if: github.event_name != 'pull_request' with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - name: Run tests run: | sudo apt-get install -y bats diff --git a/README.md b/README.md index 0407804..9910eb8 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ configuration driven. Inside your GHA pipeline, simply add the following step: ```yaml - - uses: DragosDumitrache/versioner@v2.3.0 + - uses: DragosDumitrache/versioner/versioner@v2.4.1 ``` Incrementing the `major` or `minor` versions is done simply through a bump in your project's diff --git a/version.sh b/version.sh index 8e03bad..949c265 100755 --- a/version.sh +++ b/version.sh @@ -53,10 +53,13 @@ function _calculate_version { function _extract_branch_name { git_branch=$(git branch --show-current) if [[ ! $git_branch ]]; then - git_branch=$(git name-rev --name-only $(git show -s --format=%H)) - to_remove="remotes/origin/" - git_branch=${git_branch/$to_remove/""} + git_branch="$(git name-rev --name-only $(git show -s --format=%H))" fi + git_branch=${git_branch/$to_remove/""} + to_remove="remotes/origin/" + git_branch=${git_branch/$to_remove/""} + to_remove="remotes/heads/" + git_branch=${git_branch////"-"} echo $git_branch } diff --git a/versioner/action.yml b/versioner/action.yml index e657e00..a2cde9f 100644 --- a/versioner/action.yml +++ b/versioner/action.yml @@ -11,7 +11,7 @@ runs: - uses: actions/checkout@v4 with: repository: DragosDumitrache/versioner - ref: pass-in-git-branch + ref: 2.3.0 path: tools - name: Generate and tag a new version on a PR id: semver