Skip to content

Commit

Permalink
Merge pull request JackDanger#104 from JackDanger/jackdanger/github-a…
Browse files Browse the repository at this point in the history
…ctions

Configuring GitHub Actions
  • Loading branch information
JackDanger authored Oct 16, 2019
2 parents c71dd5f + 6a52c5f commit 7594eea
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/gempush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Ruby Gem

on:
push:
branches:
- master

jobs:
build:
name: gem publishing
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x

- name: Publish to RubyGems
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
bin/gempush-if-changed
env:
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Tests

on: push

jobs:
ci:
name: CI
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- '2.3.x'
- '2.4.x'
- '2.5.x'
- '2.6.x'
rails:
- '4.2.0'
- '4.2.11.1'
steps:
- name: Install system dependencies
run: sudo apt-get install -y libsqlite3-dev
- uses: actions/checkout@master
- name: Setup ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
architecture: 'x64'
- run: gem install bundler && bundle && bundle exec rake
env:
AR_TEST_VERSION: ${{ matrix.rails }}

8 changes: 8 additions & 0 deletions bin/gempush-if-changed
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -x
if git diff --name-only HEAD..HEAD^ | egrep -q '^VERSION$'; then
# The VERSION file changed in the last commit, build the gem and push
gem build *.gemspec
gem push *.gem
fi
1 change: 1 addition & 0 deletions github-actions-test.yml

0 comments on commit 7594eea

Please sign in to comment.