diff --git a/.github/workflows/gem-publish-public.yml b/.github/workflows/gem-publish-public.yml new file mode 100644 index 00000000..0d0b555f --- /dev/null +++ b/.github/workflows/gem-publish-public.yml @@ -0,0 +1,36 @@ +name: Publish Public 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 }} + continue-on-error: true + + - name: Publish to RubyGems + run: | + gem push --verbose *.gem + env: + GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_TOKEN}}