Skip to content

fix: handle repos without version tags #13

fix: handle repos without version tags

fix: handle repos without version tags #13

Workflow file for this run

name: test
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: check some build related things
run: |
git --version
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git status
git diff
ls -la .
git tag -l
###########################################################################################
- name: specifically set a tag of v2.0.1
id: version
run: ./version-bump.sh
env:
GHA_TAG: v2.0.1
- name: test to see if the exact tag is returned
run: |
if [[ "$version_tag_numeric" == '2.0.1' ]];then
echo "winning"
else
exit 1
fi
shell: bash
env:
version_tag_numeric: ${{ steps.version.outputs.version_tag_numeric }}
version_tag: ${{ steps.version.outputs.version_tag }}
##########################################################################################
- name: specifically set a tag of v2.0.1 but check that the last version is 0.0.1
id: version_last
run: ./version-bump.sh
env:
GHA_TAG: v2.0.1
- name: test to see if the exact tag is returned
run: |
if [[ "$version_last_numeric" == '0.0.1' ]];then
echo "winning"
else
exit 1
fi
shell: bash
env:
version_last_numeric: ${{ steps.version_last.outputs.version_last_numeric }}
version_last: ${{ steps.version_last.outputs.version_last }}
###########################################################################################
- name: test to see if default patch bumping from the latest git tag of 0.0.1 works
id: version_bumped
run: ./version-bump.sh
env:
GHA_TAG: latest
- name: test if 0.0.1 is bumped to 0.0.2
run: |
if [[ "$version_tag_numeric" == '0.0.2' ]];then
echo "winning"
else
exit 1
fi
shell: bash
env:
version_tag_numeric: ${{ steps.version_bumped.outputs.version_tag_numeric }}
version_tag: ${{ steps.version_bumped.outputs.version_tag }}
###########################################################################################
- name: make a feat/ branch and merge into main to trigger a minor bump
run: |
git --version
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git branch feat/merge-test
git switch feat/merge-test
touch merge-test
echo 'merge-test' > merge-test
git add merge-test
git commit -m "merge-test"
git checkout main
git merge feat/merge-test --no-ff --commit --no-edit
git log
echo "-------------------"
git log --merges -n 1
- name: bump 0.0.1 to 0.1.0 due to the feat/ merge
id: version_bumped_gitlog_minor
run: ./version-bump.sh
env:
GHA_TAG: latest
- name: test that 0.0.1 has bumped to 0.1.0
run: |
if [[ "$version_tag_numeric" == '0.1.0' ]];then
echo "winning"
else
exit 1
fi
shell: bash
env:
version_tag_numeric: ${{ steps.version_bumped_gitlog_minor.outputs.version_tag_numeric }}
version_tag: ${{ steps.version_bumped_gitlog_minor.outputs.version_tag }}
###########################################################################################
- name: commit '#major' to the local git repo (no push)
run: |
git --version
git config user.name "GitHub Actions Bot"
git config user.email "<>"
touch wibble
echo 'bibble' > wibble
git add wibble
git commit -m '#major'
- name: bump 0.0.1 to 1.0.0 using the '#major' commit message
id: version_bumped_gitlog_major
run: ./version-bump.sh
env:
GHA_TAG: latest
- name: test that major bump has happened to 1.0.0
run: |
if [[ "$version_tag_numeric" == '1.0.0' ]];then
echo "winning"
else
exit 1
fi
shell: bash
env:
version_tag_numeric: ${{ steps.version_bumped_gitlog_major.outputs.version_tag_numeric }}
version_tag: ${{ steps.version_bumped_gitlog_major.outputs.version_tag }}
###########################################################################################