.github/workflows/master.yaml in middleware_apm-0.2.0 vs .github/workflows/master.yaml in middleware_apm-1.0.0
- old
+ new
@@ -2,11 +2,10 @@
on:
push:
branches:
- master
- - github-workflow
jobs:
release_version:
runs-on: ubuntu-latest
@@ -26,27 +25,18 @@
- name: Build Gem Package
run: |
gem build middleware_rubygem.gemspec
- - name: Check for Version Change
- id: version_check
+ - name: Get the new Version
+ id: get_new_version
run: |
- # Extract the old and new versions from the commit
- OLD_VERSION=$(git show HEAD^:lib/middleware/ruby_gem/version.rb | grep 'VERSION =' | awk '{print $3}' | tr -d '"')
+ # Extract the new version from the commit
NEW_VERSION=$(git show HEAD:lib/middleware/ruby_gem/version.rb | grep 'VERSION =' | awk '{print $3}' | tr -d '"')
-
- if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
- echo "Version changed from $OLD_VERSION to $NEW_VERSION"
- echo "::set-output name=version_changed::true"
- else
- echo "Version remains unchanged"
- echo "::set-output name=version_changed::false"
- fi
+ echo "::set-output name=version::$NEW_VERSION"
- name: Publish Gem Package
- if: steps.version_check.outputs.version_changed == 'true'
env:
GEM_HOST_API_KEY: ${{ secrets.RUBY_GEMS_API_KEY }}
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
@@ -54,15 +44,16 @@
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
- name: Create Release
- if: steps.version_check.outputs.version_changed == 'true'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- tag_name: v${{ steps.version_check.NEW_VERSION }}
- release_name: Release ${{ steps.version_check.NEW_VERSION }}
+ tag_name: v${{ steps.get_new_version.outputs.version }}
+ release_name: Release ${{ steps.get_new_version.outputs.version }}
+ body: |
+ Release ${{ steps.get_new_version.outputs.version }}
draft: false
prerelease: false