Skip to content

Bump Avo to v2.40.0 #232

Bump Avo to v2.40.0

Bump Avo to v2.40.0 #232

Workflow file for this run

name: Build, Generate Ruby Gem and Release
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
env:
RAILS_ENV: production
NODE_ENV: production
BUNDLE_WITHOUT: development:test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.0
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-production-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-production-gems-
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Get yarn cache directory path
id: production-yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: production-yarn-cache
with:
path: ${{ steps.production-yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-production-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-production-yarn-
- name: Yarn install
run: yarn install
- name: Yarn check integrity
run: yarn check --integrity
- name: Build assets
run: |
yarn prod:build:js
yarn prod:build:css
- name: Build gem
run: bundle exec rails build
- name: Get gem version
id: gem_version
run: |
echo "::set-output name=tag::$(sed "s|refs/tags/v||" <<< ${{ github.ref }})"
- name: Get release notes
id: get_release_notes
run: |
echo "::set-output name=release_notes::$(node .github/get-release-notes-from-draft.js ${{github.repository}} ${{secrets.GITHUB_TOKEN}})"
- name: Create Release
id: create_release
if: ${{steps.get_release_notes.outputs.release_notes != ''}}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
${{fromJson(steps.get_release_notes.outputs.release_notes)}}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: pkg/avo-${{steps.gem_version.outputs.tag}}.gem
asset_name: avo-${{steps.gem_version.outputs.tag}}.gem
asset_content_type: application/x-tar
- name: Publish to rubygems.org
id: publish-to-rubygems-package-registry
env:
RUBYGEMS_TOKEN: ${{ secrets.RUBYGEMS_TOKEN }}
run: |
mkdir ~/.gem
touch ~/.gem/credentials
chmod 600 ~/.gem/credentials
echo ":rubygems_api_key: ${RUBYGEMS_TOKEN}" >> ~/.gem/credentials
gem push --host https://rubygems.org/ ./pkg/avo-${{steps.gem_version.outputs.tag}}.gem
- name: Publish to GitHub Package Registry
id: publish-to-github-package-registry
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ":github: Bearer ${GITHUB_TOKEN}" >> ~/.gem/credentials
gem push --key github --host https://rubygems.pkg.github.com/avo-hq ./pkg/avo-${{steps.gem_version.outputs.tag}}.gem
- name: Publish release on avohq.io
run: curl https://avohq.io/releases/refresh_releases