name: Gem Tasks on: push: tags: - "v*" jobs: gem_build: if: "github.repository_owner == 'jekyll' && startsWith(github.event.head_commit.message, 'Release :gem:')" name: "Build Gem (Ruby ${{ matrix.ruby_version }})" runs-on: "ubuntu-latest" strategy: fail-fast: true matrix: ruby_version: - 2.7 steps: - name: Checkout Repository uses: actions/checkout@v2 - name: "Set up Ruby ${{ matrix.ruby_version }}" uses: ruby/setup-ruby@v1 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')" shell: bash - name: "Build Gem (JekyllTestPlugin ${{ steps.plugin-meta.outputs.version }})" run: gem build jekyll_test_plugin.gemspec - 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" 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"