name: Release Gem on: push: paths: - "lib/**/version.rb" jobs: release: if: "github.repository_owner == 'jekyll'" name: "Release 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=tag_version::$(bundle exec rake project:tag_version)" echo "::set-output name=gem_name::$(bundle exec rake project:gem_name)" shell: bash - 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: "${{ 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 pkg/${{ steps.plugin-meta.outputs.gem_name }}.gem git push origin ${{ steps.plugin-meta.outputs.tag_version }}