From b73a345b19d2b6fabc803cb76e93a2c658e02e07 Mon Sep 17 00:00:00 2001 From: Matt Larraz Date: Mon, 21 Dec 2020 13:00:58 -0800 Subject: [PATCH] Set up automatic publishing to Github and Rubygems (#21) --- .github/workflows/gem-push.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/gem-push.yml diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml new file mode 100644 index 0000000..f2043e7 --- /dev/null +++ b/.github/workflows/gem-push.yml @@ -0,0 +1,33 @@ +name: Ruby Gem + +on: + release: + types: + - published + +jobs: + build: + name: Build + Publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-ruby@v1 + - name: Build + run: | + gem build *.gemspec + - name: Publish to Github + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem push --verbose --key github --host https://rubygems.pkg.github.com/${OWNER} *.gem + env: + GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}" + OWNER: ${{ github.repository_owner }} + - name: Publish to RubyGems + run: | + gem push --verbose *.gem + env: + GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_TOKEN}}