.github/workflows/gem.yml in jekyll_test_plugin-0.1.1 vs .github/workflows/gem.yml in jekyll_test_plugin-0.1.2

- old
+ new

@@ -1,16 +1,16 @@ -name: Gem Tasks +name: Release Gem on: push: - tags: - - "v*" + paths: + - "lib/**/version.rb" jobs: - gem_build: - if: "github.repository_owner == 'jekyll' && startsWith(github.event.head_commit.message, 'Release :gem:')" - name: "Build Gem (Ruby ${{ matrix.ruby_version }})" + release: + if: "github.repository_owner == 'jekyll'" + name: "Release Gem (Ruby ${{ matrix.ruby_version }})" runs-on: "ubuntu-latest" strategy: fail-fast: true matrix: ruby_version: @@ -23,19 +23,27 @@ with: ruby-version: ${{ matrix.ruby_version }} bundler-cache: true - name: Extract Plugin Version id: plugin-meta - run: echo "::set-output name=version::$(bundle exec ruby -e 'require "jekyll_test_plugin"; puts JekyllTestPlugin::VERSION')" + run: | + echo "::set-output name=tag_version::$(bundle exec rake project:tag_version)" + echo "::set-output name=gem_name::$(bundle exec rake project:gem_name)" shell: bash - - name: "Build Gem (JekyllTestPlugin ${{ steps.plugin-meta.outputs.version }})" - run: gem build jekyll_test_plugin.gemspec + - name: Tag Details + env: + EVENT_JSON: ${{ toJSON(github.event) }} + run: bundle exec ruby .github/workflows/scripts/tag_info.rb + - name: "Build Gem (${{ steps.plugin-meta.outputs.gem_name }})" + run: bundle exec rake build - name: Archive gem as artifact uses: actions/upload-artifact@v2 with: - name: "jekyll_test_plugin-${{ steps.plugin-meta.outputs.version }}" - path: "jekyll_test_plugin-${{ steps.plugin-meta.outputs.version }}.gem" + name: "${{ steps.plugin-meta.outputs.gem_name }}" + path: "pkg/${{ steps.plugin-meta.outputs.gem_name }}.gem" retention-days: 5 - name: Release Gem via Rubygems.org env: GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_GEM_PUSH_API_KEY }} - run: "gem push jekyll_test_plugin-${{ steps.plugin-meta.outputs.version }}.gem" + run: | + gem push pkg/${{ steps.plugin-meta.outputs.gem_name }}.gem + git push origin ${{ steps.plugin-meta.outputs.tag_version }}