github: add basic CI #1
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: Ruby Gem | |
| on: | |
| push: | |
| branches: | |
| - "*" | |
| tags: | |
| - v* | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| ruby-version: ['3.2', '3.0', '2.7', '2.6', '2.5'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: 1 | |
| fetch-depth: 0 | |
| - name: Set up Ruby ${{ matrix.ruby-version }} | |
| uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| - run: bundle install | |
| - name: Build gem | |
| run: | | |
| gem build damage.gemspec | |
| publish: | |
| name: Publish | |
| runs-on: ubuntu-22.04 | |
| needs: build | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: 1 | |
| fetch-depth: 0 | |
| - name: Set up Ruby 3.0 | |
| uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 | |
| with: | |
| ruby-version: '3.0' | |
| - run: bundle install | |
| # - name: Publish to RubyGems | |
| # if: contains(github.ref, 'refs/tags/v') | |
| # run: | | |
| # mkdir -p $HOME/.gem | |
| # touch $HOME/.gem/credentials | |
| # chmod 0600 $HOME/.gem/credentials | |
| # printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | |
| # gem build damage.gemspec | |
| # gem push *.gem | |
| # env: | |
| # GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}" |