Created
July 11, 2020 23:57
-
-
Save jonatasdlp/26e7ff2e334245adbc40478cef615d73 to your computer and use it in GitHub Desktop.
Github action for Ruby deploy using Heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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