gem doesn’t follow bundler config #46
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: Ruby | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
test: | |
runs-on: macos-latest | |
name: Ruby ${{ matrix.ruby }} | |
strategy: | |
matrix: | |
ruby: | |
# - '3.1' # EOL: 2025-03-31 | |
# - '3.2' # EOL: 2026-03-31 | |
# - '3.3' # EOL: 2027-03-31 | |
# see supported ruby release schedule at https://www.ruby-lang.org/en/downloads/branches/ | |
- 'system' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: getargv/getargv | |
path: getargv | |
token: ${{ secrets.GH_PAT }} | |
- name: Build libgetargv | |
run: make dylib | |
working-directory: getargv | |
- name: Install libgetargv | |
run: sudo make install_dylib | |
working-directory: getargv | |
- uses: actions/checkout@v4 | |
with: | |
path: getargv_ruby | |
- name: Set up Ruby ${{ matrix.ruby }} | |
uses: ruby/setup-ruby@v1 | |
if: ${{ matrix.ruby != 'system' }} | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
working-directory: getargv_ruby | |
- name: Set up Ruby ${{ matrix.ruby }} pt 1 | |
run: | | |
echo "PATH=/usr/bin:$PATH" >> $GITHUB_ENV | |
/usr/bin/bundle config set --global path "$HOME/.bundle" | |
if: ${{ matrix.ruby == 'system' }} | |
- name: Set up Ruby ${{ matrix.ruby }} pt 2 | |
run: | | |
gem install bundler -v '~>2.4' --install-dir "$HOME/.bundle" | |
ls -R "$HOME/.bundle" | |
bundle install | |
ls -R "$HOME/.bundle" | |
working-directory: getargv_ruby | |
if: ${{ matrix.ruby == 'system' }} | |
- name: Create .ruby-version file | |
run: ruby -e 'puts RUBY_VERSION' > .ruby-version | |
working-directory: getargv_ruby | |
- name: Run the default task | |
run: bundle exec rake && false | |
working-directory: getargv_ruby | |
release: | |
runs-on: macos-latest | |
needs: [test] | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: getargv/getargv | |
path: getargv | |
token: ${{ secrets.GH_PAT }} | |
- name: Build libgetargv | |
run: make dylib | |
working-directory: getargv | |
- name: Install libgetargv | |
run: sudo make install_dylib | |
working-directory: getargv | |
- uses: actions/checkout@v4 | |
# deliberately do NOT trigger workflow on push to main | |
with: | |
path: getargv_ruby | |
token: ${{ github.token }} | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ruby | |
working-directory: getargv_ruby | |
- name: Bundle install (no deployment/frozen) | |
run: bundle install --path ./vendor/bundle | |
working-directory: getargv_ruby | |
- name: Bump version | |
# tag done by release, commit done with checksum included | |
run: bundle exec rake bump:patch COMMIT=false TAG=false | tail -1 | xargs -I {} echo "version={}" >> $GITHUB_OUTPUT | |
id: version | |
working-directory: getargv_ruby | |
- name: Run the build tasks | |
run: bundle exec rake build build:checksum | |
working-directory: getargv_ruby | |
- name: Archive Gem | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gem | |
path: getargv_ruby/pkg/*.gem | |
- name: Commit checksum and version bump | |
# add and commit separately because `git commit -am` excludes new files =( | |
run: | | |
git add -A | |
git commit -am "commit checksum for ${{steps.version.outputs.version}}" | |
working-directory: getargv_ruby | |
- name: Setup auth | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | |
env: | |
GEM_HOST_API_KEY: "Bearer ${{github.token}}" | |
- name: Release Gem to GitHub Packages | |
run: gem push --key github --host https://rubygems.pkg.github.com/getargv pkg/*.gem | |
working-directory: getargv_ruby | |
- name: Configure RubyGems Credentials | |
uses: rubygems/configure-rubygems-credentials@main | |
- name: Release Gem to RubyGems | |
# tags and pushes | |
run: bundle exec rake release[origin] | |
working-directory: getargv_ruby |