From 98e4c10a3d3c1f77c7d854f12dfbd502cf92e58d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 6 Sep 2021 04:27:04 +0100 Subject: [PATCH] Build: Switch to standard rubygems.org The RubyGems registry offered by GitHub Packages is not public, it requires installers to specify authentication tokens even for "public" packages, which is imho unreasonably difficult for something this trivial. Switch to the public registry instead. --- .github/workflows/gem.yaml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/gem.yaml b/.github/workflows/gem.yaml index aac7911..16dc45e 100644 --- a/.github/workflows/gem.yaml +++ b/.github/workflows/gem.yaml @@ -7,15 +7,13 @@ on: jobs: gem-push: runs-on: ubuntu-latest - permissions: - # https://docs.github.com/en/actions/reference/authentication-in-a-workflow - packages: write steps: - uses: actions/checkout@v2 - name: Publish Gem package env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_PUSH }}" # Inspired by https://github.com/bodyshopbidsdotcom/gh-action-publish-gem-on-tag/blob/1.0.1/entrypoint.sh + # Docs: https://guides.rubygems.org/command-reference/#gem-push run: | GIT_VERSION=$(echo "$GITHUB_REF" | cut -d'/' -f 3-) SPEC_VERSION=$(ruby -e 'require "rubygems"; gemspec = Dir.entries(".").find { |file| file =~ /.*\.gemspec/ }; spec = Gem::Specification::load(gemspec); puts spec.version') @@ -23,8 +21,5 @@ jobs: echo "Ignoring, git tag version differs from gem spec version." exit 2; fi - mkdir -p ~/.gem - echo ":github: Bearer ${GITHUB_TOKEN}" > ~/.gem/credentials - chmod 600 ~/.gem/credentials gem build *.gemspec - gem push --key github --host "https://rubygems.pkg.github.com/${{ github.repository_owner }}" *.gem + gem push *.gem