name: Test and deploy

on:
- push
- workflow_dispatch

jobs:
  test_and_deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby
      uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
      with:
        ruby-version: 2.6.3
    - name: Install dependencies
      run: bundle install
    - name: Pull image
      run: docker pull alpine
    - name: Run tests
      run: bundle exec rake
    - name: Deploy
      if: ${{ startsWith(github.ref, 'refs/tags/v') }}
      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 build *.gemspec
        gem push *.gem
      env:
        GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"


name: Test and deploy

on:
- push
- workflow_dispatch

jobs:
  test_and_deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby
      uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
      with:
        ruby-version: 2.6.3
        bundler: 2.1.4
        bundler-cache: true
    - name: Pull image
      run: docker pull alpine
    - name: Run tests
      run: bundle exec rake
    - name: Deploy
      if: ${{ startsWith(github.ref, 'refs/tags/v') }}
      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 build *.gemspec
        gem push *.gem
      env:
        GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"


Use bundler cache for actions
Use bundler cache for actions
