Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ELITERT-1198] Set-up rubygems.org deployment #6

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release and Deploy

on:
push:
branches: [ "master" ]
paths:
- lib/dragnet/version.rb

jobs:
build:
name: Build & Deploy
runs-on: ubuntu-latest
permissions:
contents: write # Needed to create the tag and the release
id-token: write # Needed to push to rubygems.org as a trusted publisher
environment: release

steps:
- uses: actions/checkout@v4
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
ruby-version: 2.7.7
- name: Build
run: |
bundler install
rake clobber
rake build
- name: Get Version
run: |
echo "GEM_VERSION=$(bundler exec ruby -e 'require "dragnet/version"; print Dragnet::VERSION')" | tee -a $GITHUB_ENV
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Github Actions
TAG_NAME: ${{ env.GEM_VERSION }}
NOTES: "[Changelog](${{ github.server_url }}/${{ github.repository }}/blob/${{ env.GEM_VERSION }}/CHANGELOG.md)"
TITLE: Release ${{ env.GEM_VERSION }}
TARGET: ${{ github.ref_name }}
run: |
gh release create $TAG_NAME --notes "$NOTES" --title "$TITLE" --target $TARGET pkg/dragnet-*.gem
- name: Configure trusted publishing credentials
uses: rubygems/[email protected]
- name: Deploy
run: |
gem push pkg/dragnet-*.gem
2 changes: 1 addition & 1 deletion dragnet.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_relative 'lib/dragnet/version'

Gem::Specification.new do |spec|

Check warning on line 5 in dragnet.gemspec

View workflow job for this annotation

GitHub Actions / lint

[rubocop] reported by reviewdog 🐶 Block has too many lines. [26/25] Raw Output: dragnet.gemspec:5:1: C: Metrics/BlockLength: Block has too many lines. [26/25]
spec.name = 'dragnet'
spec.version = Dragnet::VERSION
spec.authors = ['ESR Labs GmbH']
Expand All @@ -17,7 +17,7 @@
spec.license = 'MIT'
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')

spec.metadata['allowed_push_host'] = 'https://gems.int.esrlabs.com'
spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = spec.homepage
Expand Down
Loading