work flow changes #18
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: CI | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- master | |
- dev | |
jobs: | |
test: | |
strategy: | |
matrix: | |
include: | |
- ruby: '3.2' | |
gemfile: '7.1.0' | |
couchbase: '7.1.1' | |
- ruby: '3.0' | |
gemfile: '7.0.0' | |
couchbase: '6.6.5' | |
- ruby: '3.0' | |
gemfile: '7.0.0' | |
couchbase: '7.1.0' | |
- ruby: '2.7' | |
gemfile: '7.0.0' | |
couchbase: '7.1.0' | |
fail-fast: false | |
runs-on: ubuntu-20.04 | |
name: ${{ matrix.ruby }} rails-${{ matrix.gemfile }} couchbase-${{ matrix.couchbase }} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: sudo apt-get update && sudo apt-get install libevent-dev libev-dev python-httplib2 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
- run: bundle install | |
- run: bundle exec rspec | |
env: | |
ACTIVE_MODEL_VERSION: ${{ matrix.gemfile }} | |
COUCHBASE_VERSION: ${{ matrix.couchbase }} | |
BUNDLE_PATH: vendor/bundle | |
deploy: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2' # or your preferred Ruby version for deployment | |
bundler-cache: true | |
- run: bundle install | |
- run: gem build test-gem-publish.gemspec | |
- name: Get version from tag | |
id: get_version | |
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/v})" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./test-gem-publish-${{ env.VERSION }}.gem | |
asset_name: test-gem-publish-*.gem | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: gem push test-gem-publish-${{ env.VERSION }}.gem | |
env: | |
BUNDLE_PATH: vendor/bundle | |
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} |