Skip to content

Commit

Permalink
Merge branch 'develop' into feature/programming-exercises/editor-reme…
Browse files Browse the repository at this point in the history
…mber-scroll-position
  • Loading branch information
chrisknedl authored Dec 23, 2024
2 parents 0c3a3f0 + 97c0636 commit 574e980
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Refer to [Using JHipster in production](http://www.jhipster.tech/production) for
The following command can automate the deployment to a server. The example shows the deployment to the main Artemis test server (which runs a virtual machine):

```shell
./artemis-server-cli deploy username@artemistest.ase.in.tum.de -w build/libs/Artemis-7.8.0.war
./artemis-server-cli deploy username@artemis-test0.artemis.in.tum.de -w build/libs/Artemis-7.8.1.war
```

## Architecture
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ plugins {
}

group = "de.tum.cit.aet.artemis"
version = "7.8.0"
version = "7.8.1"
description = "Interactive Learning with Individual Feedback"

java {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "artemis",
"version": "7.8.0",
"version": "7.8.1",
"description": "Interactive Learning with Individual Feedback",
"private": true,
"license": "MIT",
Expand Down
93 changes: 93 additions & 0 deletions update_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/bash

# Script to update version in specified files and locations
# Usage: ./update_version.sh [major|minor|bugfix]

if [[ $# -ne 1 ]]; then
echo "Usage: $0 [major|minor|bugfix]"
exit 1
fi

INCREMENT_TYPE=$1

# Validate the argument
if [[ "$INCREMENT_TYPE" != "major" && "$INCREMENT_TYPE" != "minor" && "$INCREMENT_TYPE" != "bugfix" ]]; then
echo "Error: Invalid argument. Use one of [major, minor, bugfix]. No other values are allowed."
exit 1
fi

# Function to increment version
increment_version() {
local version=$1
local type=$2

IFS='.' read -r major minor bugfix <<< "$version"

case $type in
major)
major=$((major + 1))
minor=0
bugfix=0
;;
minor)
minor=$((minor + 1))
bugfix=0
;;
bugfix)
bugfix=$((bugfix + 1))
;;
esac

echo "$major.$minor.$bugfix"
}

# Read the current version from the first valid `version = "x.y.z"` in build.gradle
CURRENT_VERSION=$(awk -F'"' '/^version = "[0-9]+\.[0-9]+\.[0-9]+"/ {print $2; exit}' build.gradle)

if [[ -z "$CURRENT_VERSION" ]]; then
echo "Could not find a valid version in build.gradle."
exit 1
fi

# Get the new version
NEW_VERSION=$(increment_version "$CURRENT_VERSION" "$INCREMENT_TYPE")

# Update files
echo "Updating version from $CURRENT_VERSION to $NEW_VERSION..."

# Update build.gradle
sed -i '' "s/^version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" build.gradle

# Update package.json to only update the version when the previous line is `"name": "artemis"`
awk -v old_version="$CURRENT_VERSION" -v new_version="$NEW_VERSION" '
BEGIN {found_name = 0}
/"name": "artemis"/ {found_name = 1}
found_name && /"version": ".*"/ {
sub("\"version\": \"" old_version "\"", "\"version\": \"" new_version "\"")
found_name = 0
}
{print}
' package.json > package.json.tmp && mv package.json.tmp package.json

# Update package-lock.json to only update the version when the previous line is `"name": "artemis"`
awk -v old_version="$CURRENT_VERSION" -v new_version="$NEW_VERSION" '
BEGIN {found_name = 0}
/"name": "artemis"/ {found_name = 1}
found_name && /"version": ".*"/ {
sub("\"version\": \"" old_version "\"", "\"version\": \"" new_version "\"")
found_name = 0
}
{print}
' package-lock.json > package-lock.json.tmp && mv package-lock.json.tmp package-lock.json

# Update README.md
sed -i '' "s/Artemis-$CURRENT_VERSION.war/Artemis-$NEW_VERSION.war/" README.md

# Add changes to git and commit
echo "Staging changes for git..."
git add build.gradle package.json README.md package-lock.json

echo "Creating git commit..."
git commit -m "Development: Bump version to $NEW_VERSION ($INCREMENT_TYPE update)"

echo "Version update and git commit complete. New version: $NEW_VERSION"

0 comments on commit 574e980

Please sign in to comment.