aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/ruby.yml
diff options
context:
space:
mode:
authorMatthew Strapp <matt@mattstrapp.net>2024-10-30 15:01:13 -0500
committerGitHub <noreply@github.com>2024-10-30 15:01:13 -0500
commit7fb5261783bc975fdde6894a8c7f4ef778a19189 (patch)
tree34fcb0ba4055382a5bf5093661e39ec8eccf5bbd /.github/workflows/ruby.yml
parentdocs: Fix error in .NET example (diff)
downloadlocusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.gz
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.bz2
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.lz
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.xz
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.zst
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.zip
feat: Ruby (#33)
* bundle gem locusts Signed-off-by: Matt Strapp <matt@mattstrapp.net> * Add changeset and flesh out gemspec Signed-off-by: Matt Strapp <matt@mattstrapp.net> * Oops Signed-off-by: Matt Strapp <matt@mattstrapp.net> * nothing Signed-off-by: Matt Strapp <matt@mattstrapp.net> * actually draw the owl Signed-off-by: Matt Strapp <matt@mattstrapp.net> * oops Signed-off-by: Matt Strapp <matt@mattstrapp.net> * oops 2 Signed-off-by: Matt Strapp <matt@mattstrapp.net> --------- Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '.github/workflows/ruby.yml')
-rw-r--r--.github/workflows/ruby.yml81
1 files changed, 81 insertions, 0 deletions
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
new file mode 100644
index 0000000..cbe07e1
--- /dev/null
+++ b/.github/workflows/ruby.yml
@@ -0,0 +1,81 @@
+name: Ruby
+
+on:
+ push:
+ paths:
+ - "**.rb"
+ - "**.gemspec"
+ - "Gemfile"
+ - "Gemfile.lock"
+ - "Rakefile"
+ - ".github/workflows/ruby.yml"
+ pull_request:
+ paths:
+ - "**.rb"
+ - "**.gemspec"
+ - "Gemfile"
+ - "Gemfile.lock"
+ - "Rakefile"
+ - ".github/workflows/ruby.yml"
+
+jobs:
+ build-and-test:
+ runs-on: ubuntu-latest
+ name: Ruby
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: 3.3
+ bundler-cache: true
+ - name: Build and test with Rake
+ run: bundle exec rake
+
+ publish-preview:
+ runs-on: ubuntu-latest
+ needs: build-and-test
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
+ name: Publish Preview to GitHub Package Registry
+ permissions:
+ packages: write
+ contents: read
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set version to pre-release
+ run: sed "s/$(jq -r .version package.json)/$(jq -r .version package.json).pre/" locusts.gemspec -i
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: 3.3
+ bundler-cache: true
+ - name: Build gem
+ run: bundle exec rake build
+ - name: Set up GitHub Package Registry for RubyGems
+ run: |
+ mkdir -p ~/.gem
+ touch ~/.gem/credentials
+ chmod 0600 ~/.gem/credentials
+ echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
+ - name: Publish gem
+ run: gem push --key github --host https://rubygems.pkg.github.com/locusts-r-us pkg/*.gem
+
+ publish-release:
+ name: Push gem to RubyGems.org
+ needs: build-and-test
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/') }}
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
+ steps:
+ # Set up
+ - uses: actions/checkout@v4
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ ruby-version: 3.3
+ - name: Build gem
+ run: bundle exec rake build
+ - name: Publish gem
+ run: gem push pkg/*.gem \ No newline at end of file