chore(security): pin unpinned GitHub actions to SHAs #161
This file contains hidden or 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: CI | |
| on: push | |
| jobs: | |
| release-please: | |
| name: Release Please | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release-please.outputs.release_created }} | |
| tag_name: ${{ steps.release-please.outputs.tag_name }} # e.g. v1.0.0 | |
| version: ${{ steps.release-please.outputs.version }} # e.g. 1.0.0 | |
| steps: | |
| - uses: krystal/release-please-manifest-action@9e83450383c02fad51005c8248d04353da5be3ee # v3.0.0 | |
| id: release-please | |
| with: | |
| target-branch-pattern: '^(main|master|release-[0-9]+(\.[0-9]+)?\.x)$' | |
| app-id: ${{ vars.RELEASE_BOT_APP_ID }} | |
| private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0 | |
| with: | |
| ruby-version: 3.2 | |
| - name: Install dependencies | |
| run: bundle install | |
| - name: Run linter | |
| run: bin/rubocop | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby_version: | |
| - 2.7 | |
| - 3.0 | |
| - 3.1 | |
| - 3.2 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0 | |
| with: | |
| ruby-version: ${{ matrix.ruby_version }} | |
| - name: Install dependencies | |
| run: bundle install | |
| - name: Run tests | |
| run: bin/rspec | |
| release: | |
| name: Publish to RubyGems | |
| runs-on: ubuntu-latest | |
| needs: [release-please, test, lint] | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0 | |
| with: | |
| ruby-version: 3.2 | |
| - name: Build Gem | |
| run: gem build *.gemspec | |
| - name: Setup credentials | |
| run: | | |
| mkdir -p $HOME/.gem | |
| touch $HOME/.gem/credentials | |
| chmod 0600 $HOME/.gem/credentials | |
| printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials | |
| env: | |
| RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}} | |
| - name: Publish to RubyGems | |
| run: | | |
| gem push *.gem |