From b14929499ef64b74e606fadc99b86a90278ac24a 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 | 13 +++++++++++++ action.yml | 3 +++ scripts/set-version-envs.sh | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ebad29..2b94cc5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,19 @@ 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 }} + GITHUB_ENV: ${{ env.GITHUB_ENV }} + + - run: | + echo "redmine version begin" + echo "${{ env.VERSION_MAJOR }}" + echo "${{ env.VERSION_MINOR }}" + echo $VERSION_MAJOR + echo "redmine version end" + - name: Install a plugin for testing run: | cp -R ../.github/hello_world plugins/ diff --git a/action.yml b/action.yml index 8173ea1..532eb23 100644 --- a/action.yml +++ b/action.yml @@ -48,6 +48,9 @@ runs: - name: Define Redmine version environment variables run: ./scripts/set-version-envs.sh shell: bash + env: + REDMINE_DIR: ${{ inputs.path }} + GITHUB_ENV: ${{ env.GITHUB_ENV }} - name: Install dependencies run: | diff --git a/scripts/set-version-envs.sh b/scripts/set-version-envs.sh index a9d9ebe..0bee2c8 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}')