From 295ebe91a9fbfe2a9101eda2075c02288791ea71 Mon Sep 17 00:00:00 2001 From: Katsuya Hidaka Date: Thu, 11 Jul 2024 22:42:09 +0900 Subject: [PATCH] Use redmine version envs in build.yml --- .github/workflows/build.yml | 5 +++++ action.yml | 2 ++ scripts/set-version-envs.sh | 10 +++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ebad29..35de55b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,11 @@ jobs: database: ${{ matrix.redmine-database }} ruby-version: ${{ matrix.ruby-version }} + - name: Define Redmine version environment variables + run: ./scripts/set-version-envs.sh + env: + REDMINE_DIR: ${{ env.REDMINE_SRC }} + - name: Install a plugin for testing run: | cp -R ../.github/hello_world plugins/ diff --git a/action.yml b/action.yml index 8173ea1..9979c31 100644 --- a/action.yml +++ b/action.yml @@ -48,6 +48,8 @@ runs: - name: Define Redmine version environment variables run: ./scripts/set-version-envs.sh shell: bash + env: + REDMINE_DIR: ${{ inputs.path }} - name: Install dependencies run: | diff --git a/scripts/set-version-envs.sh b/scripts/set-version-envs.sh index a9d9ebe..d5b1064 100755 --- a/scripts/set-version-envs.sh +++ b/scripts/set-version-envs.sh @@ -1,6 +1,6 @@ #!/bin/bash -file=$REDMINE_SRC/lib/redmine/version.rb +file=$REDMINE_DIR/lib/redmine/version.rb version_major=$(grep -oE 'MAJOR *= *[0-9]+' $file | awk 'NR==1 {print $3}') version_minor=$(grep -oE 'MINOR *= *[0-9]+' $file | awk 'NR==1 {print $3}') @@ -9,7 +9,7 @@ version_branch=$(grep -oE 'BRANCH *= *'\''.+?' $file | awk -F"'" 'NR==1 {print $ echo "Redmine Version: $version_major.$version_minor.$version_tiny.$version_branch" -echo "VERSION_MAJOR=$redmine_major" >> $GITHUB_ENV -echo "VERSION_MINOR=$redmine_minor" >> $GITHUB_ENV -echo "VERSION_TINY=$redmine_tiny" >> $GITHUB_ENV -echo "VERSION_BRANCH=$redmine_branch" >> $GITHUB_ENV +echo "VERSION_MAJOR=$version_major" >> $GITHUB_ENV +echo "VERSION_MINOR=$version_minor" >> $GITHUB_ENV +echo "VERSION_TINY=$version_tiny" >> $GITHUB_ENV +echo "VERSION_BRANCH=$version_branch" >> $GITHUB_ENV