From fb5ba840bb2d21082e27f77f64b77bd3f2b6bbe1 Mon Sep 17 00:00:00 2001 From: James Couball Date: Thu, 17 Apr 2025 07:50:09 -0700 Subject: [PATCH] fix: do not trigger build workflows after merging to main or for release PRs Since all merges to the main branch must be a fast-forward rebase, CI builds should not be run when merged to main. They are run via the pull request before merging. The continuous_integration workflow should be triggered for pull requests targeting main. The experimental_ruby_builds workflow should only be triggered manually via the GitHub UI. Move unneeded builds from continuous_integration to experimental_ruby_builds There is not a good reason to have a specific builds in the continuous_integration workflow on Windows, or using JRuby or TruffleRuby. --- .../{main.yml => continuous_integration.yml} | 31 +++--- .github/workflows/release.yml | 100 +++++++++--------- 2 files changed, 67 insertions(+), 64 deletions(-) rename .github/workflows/{main.yml => continuous_integration.yml} (56%) diff --git a/.github/workflows/main.yml b/.github/workflows/continuous_integration.yml similarity index 56% rename from .github/workflows/main.yml rename to .github/workflows/continuous_integration.yml index 40bf372..bcd2fcf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/continuous_integration.yml @@ -1,28 +1,31 @@ -name: CI Build +name: Continuous Integration on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + branches: [main] + + workflow_dispatch: jobs: build: + name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }} + + if: >- + github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'release-please--')) + + runs-on: ${{ matrix.operating-system }} continue-on-error: true + env: + FAIL_ON_LOW_COVERAGE: ${{ matrix.fail_on_low_coverage }} + strategy: + fail-fast: false matrix: - ruby: ['3.1', '3.4', jruby-head] + ruby: ["3.1", "3.4"] operating-system: [ubuntu-latest] - include: - - ruby: '3.1' - operating-system: windows-latest - - ruby: jruby-head - operating-system: windows-latest - - name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }} - runs-on: ${{ matrix.operating-system }} + fail_on_low_coverage: [true] steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 488a028..329968a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,51 +1,51 @@ --- -name: Release Gem -description: | - This workflow creates a new release on GitHub and publishes the gem to - RubyGems.org. - - The workflow uses the `googleapis/release-please-action` to handle the - release creation process and the `rubygems/release-gem` action to publish - the gem. - -on: - push: - branches: ["main"] - - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - - environment: - name: RubyGems - url: https://rubygems.org/gems/github_pages_rake_tasks - - permissions: - contents: write - pull-requests: write - id-token: write - - steps: - - name: Checkout project - uses: actions/checkout@v4 - - - name: Create release - uses: googleapis/release-please-action@v4 - id: release - with: - token: ${{ secrets.AUTO_RELEASE_TOKEN }} - config-file: release-please-config.json - manifest-file: .release-please-manifest.json - - - name: Setup ruby - uses: ruby/setup-ruby@v1 - if: ${{ steps.release.outputs.release_created }} - with: - bundler-cache: true - ruby-version: ruby - - - name: Push to RubyGems.org - uses: rubygems/release-gem@v1 - if: ${{ steps.release.outputs.release_created }} + name: Release Gem + description: | + This workflow creates a new release on GitHub and publishes the gem to + RubyGems.org. + + The workflow uses the `googleapis/release-please-action` to handle the + release creation process and the `rubygems/release-gem` action to publish + the gem. + + on: + push: + branches: ["main"] + + workflow_dispatch: + + jobs: + release: + runs-on: ubuntu-latest + + environment: + name: RubyGems + url: https://rubygems.org/gems/process_executer + + permissions: + contents: write + pull-requests: write + id-token: write + + steps: + - name: Checkout project + uses: actions/checkout@v4 + + - name: Create release + uses: googleapis/release-please-action@v4 + id: release + with: + token: ${{ secrets.AUTO_RELEASE_TOKEN }} + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + + - name: Setup ruby + uses: ruby/setup-ruby@v1 + if: ${{ steps.release.outputs.release_created }} + with: + bundler-cache: true + ruby-version: ruby + + - name: Push to RubyGems.org + uses: rubygems/release-gem@v1 + if: ${{ steps.release.outputs.release_created }}