From 45e9e84ed09a4cef9523bf4efa26d41b0ea93fe8 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 7 Sep 2023 12:09:06 -0700 Subject: [PATCH] Only call `rake set-version-to-timestamp` if we're on a branch This will make it possible to build precompiled gems with the right version tag. --- .github/workflows/tests.yml | 4 ++-- scripts/test-gem-build | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 487451e..8fa3793 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -105,7 +105,7 @@ jobs: with: ruby-version: "3.2" bundler-cache: true - - run: ./scripts/test-gem-build gems ruby + - run: ./scripts/test-gem-build gems ruby ${{github.ref_type}} - uses: actions/upload-artifact@v3 with: name: cruby-gem @@ -209,7 +209,7 @@ jobs: - run: | docker run --rm -v "$(pwd):/re2" -w /re2 \ "ghcr.io/rake-compiler/rake-compiler-dock-image:1.3.0-mri-${{matrix.platform}}" \ - ./scripts/test-gem-build gems ${{matrix.platform}} + ./scripts/test-gem-build gems ${{matrix.platform}} ${{github.ref_type}} - uses: actions/upload-artifact@v3 with: name: "cruby-${{matrix.platform}}-gem" diff --git a/scripts/test-gem-build b/scripts/test-gem-build index 0b8dc8b..168145a 100755 --- a/scripts/test-gem-build +++ b/scripts/test-gem-build @@ -11,13 +11,17 @@ set -e -u OUTPUT_DIR=$1 BUILD_NATIVE_GEM=$2 +REF_TYPE=$3 test -e /etc/os-release && cat /etc/os-release set -x bundle install --local || bundle install -bundle exec rake set-version-to-timestamp + +if [[ "${REF_TYPE}}" != "tag" ]]; then + bundle exec rake set-version-to-timestamp +fi if [[ "${BUILD_NATIVE_GEM}" == "ruby" ]] ; then bundle exec rake clean