Skip to content

release

release #69

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
next_version:
description: |
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
required: true
default: 'patch'
push:
tags: [ v* ]
concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ruby/setup-ruby@master
with:
ruby-version: '3.1'
bundler: ${{ env.BUNDLER_VER }}
- if: ${{ github.event_name == 'workflow_dispatch' }} # unfortunatelly cannot keep this condition on job level
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
gem install gem-release
gem bump --version ${{ github.event.inputs.next_version }} --tag --push
pack:
runs-on: ubuntu-latest
needs: bump
strategy:
fail-fast: false
matrix:
platform: [ linux-gnu, windows, darwin ]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
ref: main # https://github.com/actions/checkout/issues/439#issuecomment-830862188
- uses: ruby/setup-ruby@master
with:
ruby-version: '3.1'
# bundler-cache: true important to not use cache because it leads to "cannot find -lrice"
# more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
- run: bundle install --jobs 4 --retry 3
# build gem WITHOUT pre-built native extension
- run: gem build expressir.gemspec
- if: matrix.host == 'linux-gnu'
uses: actions/upload-artifact@v3
with:
name: pkg-ruby
path: expressir-*.gem
- name: Enable swap
run: |
sudo fallocate -l 15g /compile.swap
sudo chmod 600 /compile.swap
sudo mkswap /compile.swap
sudo swapon /compile.swap
sudo swapon --all --verbose
# build gem WITH pre-built native extension
- run: bundle exec rake gem:${{ matrix.platform }}
- uses: actions/upload-artifact@v3
with:
name: pkg-${{ matrix.platform }}
path: pkg/*.gem
publish:
runs-on: ubuntu-latest
needs: pack
steps:
- uses: actions/download-artifact@v3
with:
name: pkg-ruby
path: pkg
- uses: actions/download-artifact@v3
with:
name: pkg-linux-gnu
path: pkg
- uses: actions/download-artifact@v3
with:
name: pkg-windows
path: pkg
- uses: actions/download-artifact@v3
with:
name: pkg-darwin
path: pkg
- uses: ruby/setup-ruby@master
with:
ruby-version: '3.1'
- run: ls -l pkg/
- name: Publish to rubygems.org
env:
RUBYGEMS_API_KEY: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
run: |
mkdir -p ~/.gem
cat > ~/.gem/credentials << EOF
---
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
gem signin
for gem in pkg/*.gem; do gem push $gem -V; done