Skip to content

Merge pull request #34 from tchak/add-remove-methods #9

Merge pull request #34 from tchak/add-remove-methods

Merge pull request #34 from tchak/add-remove-methods #9

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "lib/selma/version.rb"
env:
CACHE_KEY_PREFIX: "cruby-v1-"
# "3.1,3.2" # SUPPORTED_RUBY_VERSIONS
# ["3.1", "3.2"] # SUPPORTED_RUBY_MATRIX
# "3.2" # LATEST_RUBY_VERSION
jobs:
native_gem:
name: Compile native gem
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- ruby
- x86_64-linux
- aarch64-linux
- x86_64-darwin
- arm64-darwin
- x64-mingw-ucrt
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: yettoapp/actions/setup-languages@main
with:
ruby: true
- uses: oxidize-rb/actions/cross-gem@v1
if: ${{ matrix.platform != 'ruby' }}
id: cross-gem
with:
platform: ${{ matrix.platform }}
ruby-versions: "3.1,3.2" # SUPPORTED_RUBY_VERSIONS
- name: Generic Ruby build
if: ${{ matrix.platform == 'ruby' }}
run: |
bundle exec rake compile
bundle exec rake build
- name: Publish to RubyGems
env:
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_API_BOT_KEY}}
GEM_OUTPUT_PATH: ${{ steps.cross-gem.outputs.gem-path }}
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
if [ -n "${GEM_OUTPUT_PATH}" ]; then
gem push "${GEM_OUTPUT_PATH}"
echo "Pushed ${GEM_OUTPUT_PATH}"
else
gem push pkg/selma-*.gem
fi
release:
needs: ["native_gem"]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: "3.2" # LATEST_RUBY_VERSION
bundler-cache: true
- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "Actions Auto Build"
- name: Get current version
id: version-label
run: |
VERSION=$(grep VERSION lib/selma/version.rb | head -n 1 | cut -d'"' -f2)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create tag
run: |
git tag -a v${{ steps.version-label.outputs.version }} -m "Release v${{ steps.version-label.outputs.version }}"
git push origin --tags
- name: Generate CHANGELOG.md
id: changelog
run: script/generate_changelog
- name: Commit & Push Changelog
run: |
git config --local user.email "[email protected]"
git config --local user.name "Actions Auto Build"
git add -f CHANGELOG.md
git commit -m "docs: update changelog" || true
git push
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.version-label.outputs.version }} --generate-notes