Skip to content

Commit

Permalink
Support only the version that the Redmine community supports
Browse files Browse the repository at this point in the history
  • Loading branch information
hidakatsuya committed Jul 13, 2024
1 parent 7fafb9c commit cc67d2d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ This action installs Redmine and sets up an environment to run tests. It is prim
See also [action.yml](./action.yml).
## Supported Redmine version
v4.2 or later
## Example
### Setting up [RedMica](https://github.com/redmica/redmica)
Expand Down
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ runs:
env:
REDMINE_DIR: ${{ inputs.path }}

- name: Check if the Redmine version is supported
run: |
if [ $redmine_version_number -lt $MINIUMUM_SUPPORTED_REDMINE_VERSION ]; then
echo "Redmine version $REDMINE_VERSION is not supported."
exit 1
fi
shell: bash
env:
MINIUMUM_SUPPORTED_REDMINE_VERSION: "420" # v4.2.0

- name: Set up base environment
run: |
major_version_with_branch=$REDMINE_VERSION_MAJOR.$REDMINE_VERSION_MINOR.$REDMINE_VERSION_BRANCH
Expand Down
17 changes: 16 additions & 1 deletion scripts/set-version-envs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,24 @@ version_minor=$(grep -oE 'MINOR *= *[0-9]+' $file | awk 'NR==1 {print $3}')
version_tiny=$(grep -oE 'TINY *= *[0-9]+' $file | awk 'NR==1 {print $3}')
version_branch=$(grep -oE 'BRANCH *= *'\''.+?' $file | awk -F"'" 'NR==1 {print $2}')

echo "Redmine Version: $version_major.$version_minor.$version_tiny.$version_branch"
redmine_version=$version_major.$version_minor.$version_tiny.$version_branch
redmine_version_number=$version_major$version_minor$version_tiny

# v5.1.3.stable -> 5.1.3.stable
echo "REDMINE_VERSION=$redmine_version" >> $GITHUB_ENV

# v5.1.3.stable -> 5
echo "REDMINE_VERSION_MAJOR=$version_major" >> $GITHUB_ENV
# v5.1.3.stable -> 1
echo "REDMINE_VERSION_MINOR=$version_minor" >> $GITHUB_ENV
# v5.1.3.stable -> 3
echo "REDMINE_VERSION_TINY=$version_tiny" >> $GITHUB_ENV
# v5.1.3.stable -> stable
echo "REDMINE_VERSION_BRANCH=$version_branch" >> $GITHUB_ENV

# v5.1.3.stable -> 513
echo "REDMINE_VERSION_NUMNER=$redmine_version_number" >> $GITHUB_ENV

# Output version information
echo "Redmine Version: $redmine_version"
echo "Redmine Version Number: $redmine_version_number"

0 comments on commit cc67d2d

Please sign in to comment.