Skip to content

Instantly share code, notes, and snippets.

@jonatasdlp
Created July 11, 2020 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonatasdlp/26e7ff2e334245adbc40478cef615d73 to your computer and use it in GitHub Desktop.
Save jonatasdlp/26e7ff2e334245adbc40478cef615d73 to your computer and use it in GitHub Desktop.
Github action for Ruby deploy using Heroku
name: Ruby Deploy
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.5
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Install Bundler
run: |
gem install bundler
- name: Install Gems
run: bundle install --path vendor/bundle --jobs 4 --retry 3
- name: Deploy to Heroku
env:
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_KEY }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
if: github.ref == 'refs/heads/master' && job.status == 'success'
run: git push https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git origin/master:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment