luislavena/gem-compiler

View on GitHub
.github/workflows/release.yml

Summary

Maintainability
Test Coverage
name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build:
    name: Build + Publish
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby:
          # use always oldest supported version
          - '2.5'
    steps:
    - uses: actions/checkout@v2.3.4
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1.64.1
      with:
        ruby-version: ${{ matrix.ruby }}
        bundler-cache: true
    - name: Build gem
      run: |
        rake package
    - name: Publish to RubyGems
      run: |
        mkdir -p $HOME/.gem
        touch $HOME/.gem/credentials
        chmod 0600 $HOME/.gem/credentials
        printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
        gem push pkg/gem-compiler-*.gem
      env:
        GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
    - name: Create Release
      id: create_release
      uses: actions/create-release@v1.1.4
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: ${{ github.ref }}
        draft: true
        prerelease: false