RubyGems Deploy #4
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: RubyGems Deploy | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build and Deploy CLI | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby and install dependencies | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2.2' | |
bundler-cache: true | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle install | |
- name: Build and install gem locally | |
run: | | |
bundle exec rake build | |
gem install pkg/*.gem | |
- name: Test emerge CLI | |
run: | | |
# Update PATH to include both system and user gem paths | |
export PATH="$(ruby -e 'puts Gem.user_dir')/bin:$(ruby -e 'puts Gem.dir')/bin:$PATH" | |
OUTPUT=$(emerge -h 2>&1 || true) | |
echo "$OUTPUT" | |
# Check for expected strings | |
echo "$OUTPUT" | grep -q "emerge integrate \[SUBCOMMAND\]" || { echo "Expected integrate command not found"; exit 1; } | |
echo "$OUTPUT" | grep -q "emerge upload \[SUBCOMMAND\]" || { echo "Expected upload command not found"; exit 1; } | |
- name: Release Gem | |
uses: rubygems/release-gem@v1 |