diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index af5d0b5..7221da9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,27 +11,7 @@ permissions: jobs: tests: - runs-on: ubuntu-latest - strategy: - matrix: - ruby-version: ['2.6', '2.7', '3.0', '3.2'] - - steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf - with: - ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true - - - name: Bundle Install - run: bundle check || bundle install -j 20 - - - name: Rubocop - run: bundle exec rubocop - - - name: RSpec - run: bundle exec rspec --format documentation + uses: ./.github/workflows/ruby-tests.yml release: needs: tests runs-on: ubuntu-latest @@ -60,5 +40,5 @@ jobs: - name: Publish gem env: GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} - GEM_HOST_OTP_CODE: ${{ github.event.inputs.otp_code }} - run: echo $GEM_HOST_OTP_CODE | gem push mp-utils-*.gem --otp \ No newline at end of file + GEM_HOST_OTP_CODE: ${{ secrets.GEM_HOST_OTP_CODE }} + run: gem push mp-utils-*.gem \ No newline at end of file diff --git a/.github/workflows/ruby-ci.yml b/.github/workflows/ruby-ci.yml index 42243c7..f745a95 100644 --- a/.github/workflows/ruby-ci.yml +++ b/.github/workflows/ruby-ci.yml @@ -4,30 +4,6 @@ on: pull_request: branches: [ "main" ] -permissions: - contents: read - packages: write - jobs: tests: - runs-on: ubuntu-latest - strategy: - matrix: - ruby-version: ['2.6', '2.7', '3.0', '3.2'] - - steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf - with: - ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true - - - name: Bundle Install - run: bundle check || bundle install -j 20 - - - name: Rubocop - run: bundle exec rubocop - - - name: RSpec - run: bundle exec rspec --format documentation \ No newline at end of file + uses: ./.github/workflows/ruby-tests.yml \ No newline at end of file diff --git a/.github/workflows/ruby-tests.yml b/.github/workflows/ruby-tests.yml new file mode 100644 index 0000000..7bb12fd --- /dev/null +++ b/.github/workflows/ruby-tests.yml @@ -0,0 +1,32 @@ +name: Ruby Tests + +on: + workflow_call: + +permissions: + contents: read + packages: write + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.6', '2.7', '3.0', '3.2'] + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Bundle Install + run: bundle check || bundle install -j 20 + + - name: Rubocop + run: bundle exec rubocop + + - name: RSpec + run: bundle exec rspec --format documentation \ No newline at end of file