diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b18fd29 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'weekly' diff --git a/.github/workflows/push_gem.yml b/.github/workflows/push_gem.yml new file mode 100644 index 0000000..f662094 --- /dev/null +++ b/.github/workflows/push_gem.yml @@ -0,0 +1,46 @@ +name: Publish gem to rubygems.org + +on: + push: + tags: + - 'v*' + +permissions: + contents: read + +jobs: + push: + if: github.repository == 'ruby/ruby2_keywords' + runs-on: ubuntu-latest + + environment: + name: rubygems.org + url: https://rubygems.org/gems/ruby2_keywords + + permissions: + contents: write + id-token: write + + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit + + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set up Ruby + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 + with: + bundler-cache: true + ruby-version: "ruby" + + - name: Publish to RubyGems + uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1 + + - name: Create GitHub release + run: | + tag_name="$(git describe --tags --abbrev=0)" + gh release create "${tag_name}" --verify-tag --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2aae1ac..5932c89 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,14 +3,28 @@ name: test on: [push, pull_request] jobs: + ruby-versions: + uses: ruby/actions/.github/workflows/ruby_versions.yml@master + with: + engine: cruby + min_version: 2.1 + build: + needs: ruby-versions name: build (${{ matrix.ruby }} / ${{ matrix.os }}) strategy: matrix: - ruby: [ '3.0', 2.7, 2.6, 2.1, head, truffleruby-head ] + ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} os: [ ubuntu-latest, macos-latest, windows-latest ] + include: + - { os: ubuntu-latest, ruby: truffleruby-head } + - { os: macos-latest, ruby: truffleruby-head } exclude: - - { os: windows-latest, ruby: truffleruby-head } + - { os: macos-latest, ruby: 2.1 } + - { os: macos-latest, ruby: 2.2 } + - { os: macos-latest, ruby: 2.3 } + - { os: macos-latest, ruby: 2.4 } + - { os: macos-latest, ruby: 2.5 } runs-on: ${{ matrix.os }} steps: - name: git config @@ -23,24 +37,19 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - - name: Install - id: bundle - run: | - bundle install - echo "::set-output name=exec::bundle exec" - if: "matrix.ruby <= '2.1'" + bundler-cache: true - name: Run test - run: ${{steps.bundle.outputs.exec}} rake test + run: bundle exec rake test - id: build run: | rake build - echo "::set-output name=pkg::${GITHUB_REPOSITORY#*/}-${RUNNING_OS%-*}" + echo "pkg=${GITHUB_REPOSITORY#*/}-${RUNNING_OS%-*}" >> $GITHUB_OUTPUT env: RUNNING_OS: ${{matrix.os}} if: "matrix.ruby == '3.0'" shell: bash - name: Upload package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: path: pkg/*.gem name: ${{steps.build.outputs.pkg}} diff --git a/.gitignore b/.gitignore index 6c2c094..230b7e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ ChangeLog logs/ gems.locked +pkg/ diff --git a/rakelib/version.rake b/rakelib/version.rake index c56ea56..bbb327f 100644 --- a/rakelib/version.rake +++ b/rakelib/version.rake @@ -12,7 +12,7 @@ class << (helper = Bundler::GemHelper.instance) end def commit_bump - sh(%W[git -C #{__dir__} commit -m bump\ up\ to\ #{gemspec.version} + sh(%W[git commit -m bump\ up\ to\ #{gemspec.version} #{gemspec.loaded_from}]) end