Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mheap committed Oct 11, 2020
1 parent ea4f1b0 commit b50199a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish Gem

on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Find yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: JS package cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install packages
run: |
yarn install --pure-lockfile
- name: Set up Ruby 2.5.8
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.8
- name: Ruby gem cache
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install postgres headers
run: sudo apt-get -yqq install libpq-dev
- name: Bundle Setup
run: |
gem update --system 3.0.3 -N
gem install --no-document bundler
bundle config path ${{ github.workspace }}/vendor/bundle
working-directory: ./lib/nexmo_developer
- name: Bundle Install
env:
POSTGRES_USERNAME: postgres
run: |
bundle install --jobs 4 --retry 3
working-directory: ./lib/nexmo_developer

- name: Precompile assets
env:
RAILS_SERVE_STATIC_FILES: 1
DISABLE_SSL: 1
RAILS_LOG_TO_STDOUT: 1
RAILS_ENV: production
run: bundle exec rails assets:precompile
working-directory: ./lib/nexmo_developer

- name: Set Credentials
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}

- name: Publish to GitHub Packages
run: |
export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 )
gem build station.gemspec
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
2 changes: 1 addition & 1 deletion nexmo_developer.gemspec → station.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require_relative "lib/nexmo_developer/version"

Gem::Specification.new do |spec|
spec.name = "nexmo-developer"
spec.name = "station"
spec.version = NexmoDeveloper::VERSION
spec.authors = ["Nexmo DevRel"]
spec.email = ["[email protected]"]
Expand Down

0 comments on commit b50199a

Please sign in to comment.