From 48921d5934edac82dda84a1453541036052eea8e Mon Sep 17 00:00:00 2001 From: Ramon de C Valle Date: Fri, 15 Nov 2024 01:00:21 -0800 Subject: [PATCH] Update workflows --- .github/workflows/gem.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gem.yml b/.github/workflows/gem.yml index ce30879..3b3b729 100644 --- a/.github/workflows/gem.yml +++ b/.github/workflows/gem.yml @@ -53,10 +53,10 @@ jobs: fi fi - version=$(grep -E "Version = \[([0-9]+), ([0-9]+), ([0-9]+)\]" *.gemspec) - major=$(echo "$version" | grep -Eo '\[[0-9]+' | tr -d '[') - minor=$(echo "$version" | grep -Eo ', [0-9]+,' | tr -d ', ') - patch=$(echo "$version" | grep -Eo ', [0-9]+\]' | tr -d ', ]') + version=$(grep -E "Version = \[[0-9]+, [0-9]+, [0-9]+\]" *.gemspec | grep -Eo '\[[0-9]+, [0-9]+, [0-9]+\]' | tr -d '[]') + major=$(echo "$version" | cut -d, -f1 | tr -d ' ') + minor=$(echo "$version" | cut -d, -f2 | tr -d ' ') + patch=$(echo "$version" | cut -d, -f3 | tr -d ' ') case $version_increment in major) @@ -76,8 +76,8 @@ jobs: ;; esac - new_version="Version = [$new_major, $new_minor, $new_patch]" - sed -i "s/^Version = \[.*\]/${new_version}/" *.gemspec + new_version="${new_major}, ${new_minor}, ${new_patch}" + sed -i -E "s/(Version = \[)[0-9]+, [0-9]+, [0-9]+/\1${new_version}/" *.gemspec echo "version=$major.$minor.$patch" >> $GITHUB_ENV echo "new_version=$new_major.$new_minor.$new_patch" >> $GITHUB_ENV @@ -102,6 +102,11 @@ jobs: gh release create "v${{ env.new_version }}" -F "$changelog" -t "v${{ env.new_version }}" rm "$changelog" + - name: Build + run: | + bundle install + gem build *.gemspec + - name: Publish to GitHub Packages env: GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"