From f50b3c1408baffb394ed7f387f5cf87bdca9cb2d Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Sat, 2 Apr 2022 17:40:56 -0700 Subject: [PATCH] build: add release-please action for releasing to RubyGems --- .github/workflows/publish.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6bd4070 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,41 @@ +name: Publish + +on: + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: GoogleCloudPlatform/release-please-action@v3 + id: release + with: + token: ${{ secrets.GITHUB_TOKEN }} + release-type: ruby + package-name: redaction + bump-minor-pre-major: true + version-file: "lib/redaction/version.rb" + - uses: actions/checkout@v2 + if: ${{ steps.release.outputs.release_created }} + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1.0 + if: ${{ steps.release.outputs.release_created }} + - run: | + gem install bundler -v 2.3.3 + bundle install + bin/test + if: ${{ steps.release.outputs.release_created }} + - name: release gem + 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 *.gemspec + gem push *.gem + env: + GEM_HOST_API_KEY: "${{secrets.GEM_HOST_API_KEY}}" + if: ${{ steps.release.outputs.release_created }}