Skip to content
Snippets Groups Projects
Commit 4f75c8d5 authored by senza's avatar senza
Browse files

[patch] Risefor Versionning CI - fix auth issues

parent 84af1bfb
Branches
Tags v2.5.1
No related merge requests found
variables:
GIT_STRATEGY: fetch
stages:
- build
- test
......@@ -10,7 +13,7 @@ build:
artifacts:
paths:
# just setting /applications/risefor-front/ throws error, setting full path as temp workaround
- /home/gitlab-runner/builds/eGNSascF4/0/applications/risefor-front/ # Adjust this path to your build output directory
- /home/gitlab-runner/builds/2zkxs7HHG/0/applications/risefor-front/ # Adjust this path to your build output directory
#- "!/home/gitlab-runner/builds/eGNSascF4/0/applications/risefor-front/.git/"
expire_in: 1 week
......@@ -26,27 +29,37 @@ test:
update_version:
stage: build
script:
- echo "Setting permissions"
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- ssh-keyscan git.risefor.org >> ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- echo "using key "$SSH_PRIVATE_KEY" | base64 -d"
- ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d)
- echo set remote to ssh and test connexion
- git remote set-url origin git@git.risefor.org:applications/risefor-front.git
- ssh -T git@git.risefor.org
- echo "Updating version..."
- echo "Checking latest version from tags..."
- latest_version=$(git tag --sort=-v:refname | head -n1)
- echo "Latest version found $latest_version"
- 'INITIAL_VERSION=${latest_version:-"2.5.0"}'
- 'INITIAL_VERSION=${latest_version:-"v2.5.0"}'
- echo "Initial version set to $INITIAL_VERSION"
- echo "Checking commit message for version bump..."
- |
# Check if the commit message contains [major], [minor], or [patch]
if grep -qE '\[major\]' <<< "$CI_COMMIT_MESSAGE"; then
echo "Major version bump detected"
new_version=$(semver -i major $INITIAL_VERSION)
new_version=v$(semver -i major $INITIAL_VERSION)
elif grep -qE '\[minor\]' <<< "$CI_COMMIT_MESSAGE"; then
echo "Minor version bump detected"
new_version=$(semver -i minor $INITIAL_VERSION)
new_version=v$(semver -i minor $INITIAL_VERSION)
elif grep -qE '\[patch\]' <<< "$CI_COMMIT_MESSAGE"; then
echo "Patch version bump detected"
new_version=$(semver -i patch $INITIAL_VERSION)
echo "Patch version bump detected $INITIAL_VERSION"
new_version=v$(semver -i patch $INITIAL_VERSION)
echo "Patch version bump detected $new_version"
else
echo "No version bump detected, defaulting to patch increment"
new_version=$(semver -i patch $INITIAL_VERSION)
echo "No version bump detected, skip version"
exit 0 # Exit without incrementing version
fi
echo "New version set to: $new_version"
......@@ -57,4 +70,4 @@ update_version:
# Push the new tag to the repository
git push origin $new_version
only:
- risefor_main/master
\ No newline at end of file
- risefor_main/master
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment