name: Release

on:
  create:
    ref_type: tag

jobs:
  release:
    runs-on: ubuntu-latest
    if: github.repository == 'voxpupuli/beaker-hostgenerator'
    steps:
      - uses: actions/checkout@v2
      - name: Install Ruby 2.7
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '2.7'
      - name: Build gem
        run: gem build *.gemspec
      - name: Publish gem
        run: gem push *.gem
        env:
          GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
