diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f6f614e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,36 @@ +name: Publish to GitHub Gems + +on: + push: + tags: + - 'v*.*.*' + +jobs: + publish: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + # ruby-version is not needed with a .ruby-version + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Build gem + run: gem build scorm_engine.gemspec + + - name: Publish to GitHub Packages + env: + GEM_HOST_API_KEY: ${{ secrets.GIT_HUB_PACKAGES_TOKEN }} + run: | + gem push --host https://rubygems.pkg.github.com/get-bridge *.gem diff --git a/README.md b/README.md index bd8144f..a369e17 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,32 @@ A ruby client for Rustici's SCORM Engine 2017.1 API and limited support for the ## Installation +### From GitHub Packages (Recommended) + +Remote packages: +New versions are automatically published to GitHub Packages when a git tag matching `v*.*.*` (e.g., `v0.10.0`) is pushed to the repository. + +Local packages: +First, configure your Bundler to authenticate with GitHub Packages: + +```bash +# Replace YOUR_GITHUB_USERNAME and YOUR_GITHUB_TOKEN with your actual values +bundle config https://rubygems.pkg.github.com/get-bridge YOUR_GITHUB_USERNAME:YOUR_GITHUB_TOKEN +``` + +You'll need a GitHub Personal Access Token with `read:packages` scope. Create one at: +https://github.com/settings/tokens + +Then add this line to your application's Gemfile: + +```ruby +source "https://rubygems.pkg.github.com/get-bridge" do + gem 'scorm_engine' +end +``` + +### From RubyGems (Legacy) + Add this line to your application's Gemfile: gem 'scorm_engine' diff --git a/scorm_engine.gemspec b/scorm_engine.gemspec index f00b946..9f54f26 100644 --- a/scorm_engine.gemspec +++ b/scorm_engine.gemspec @@ -12,7 +12,12 @@ Gem::Specification.new do |spec| spec.description = "Ruby Client for Rustici's SCORM Engine 24 API v2" spec.homepage = "https://github.com/get-bridge/scorm_engine" spec.license = "MIT" - spec.metadata = { "documentation_uri" => "https://get-bridge.github.io/scorm_engine/" } + spec.metadata = { + "documentation_uri" => "https://get-bridge.github.io/scorm_engine/", + "github_repo" => "https://github.com/get-bridge/scorm_engine", + "source_code_uri" => "https://github.com/get-bridge/scorm_engine", + "allowed_push_host" => "https://rubygems.pkg.github.com/get-bridge" + } spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile .rspec] spec.bindir = "exe"