mumuki/mumukit

View on GitHub
.github/workflows/test_and_deploy.yml

Summary

Maintainability
Test Coverage
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@v1
      with:
        ruby-version: 3.2.2
        bundler: 2.4.7
        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}}"