Skip to content

Commit

Permalink
update publish to rubygem workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
xuan-cao-swi committed Aug 5, 2023
1 parent abff32b commit 9a566fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
39 changes: 16 additions & 23 deletions .github/workflows/build_and_release_gem.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# Copyright (c) 2021 SolarWinds, LLC.
# Copyright (c) 2023 SolarWinds, LLC.
# All rights reserved.

name: BUILD, VERIFY, and RELEASE Ruby Gem to RubyGems

name: Ruby Gem to RubyGems
# This workflow relies on the following secrets
# - TRACE_BUILD_RUBY_ACTIONS_API_TOKEN (from the trace-build user in github)
# - RUBYGEMS_TOKEN (from the solarwinds-apm user on rubygems.org)
# - SW_APM_SERVICE_KEY
# - SW_APM_COLLECTOR
# - APM_RUBY_INSTALL_TESTING_SWO_KEY
# - CI_GITHUB_TOKEN
#
# The correct oboe version has to be in the file ext/oboe_metal/src/VERSION

on:
workflow_dispatch:

jobs:
build:
# act -j publish_to_ruby_gem --container-architecture linux/arm64 --secret-file act.secrets
publish_to_ruby_gem:
name: Build + Release Gem to RubyGems
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Ruby 2.7 and bundle
- name: Set up Ruby 3.1.0 and bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: '3.1'

- name: Install gems
run: |
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Install swig 4.0.2
run: |
apt udate && apt install -y --no-install-recommends bison
apt update && apt install -y --no-install-recommends bison
curl -SL https://github.com/swig/swig/archive/refs/tags/v4.0.2.tar.gz | tar xzC /tmp
cd /tmp/swig-4.0.2
./autogen.sh && ./configure && make && sudo make install
Expand All @@ -49,8 +49,8 @@ jobs:
- name: Build Gem and upload to Rubygems
id: build
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_TOKEN }}
# env:
# GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_TOKEN }}
run: |
bundle exec rake build_and_publish_gem
checksum=`shasum -a256 *.gem | awk '{print $1;}'`
Expand All @@ -68,6 +68,7 @@ jobs:
run: |
echo "local checksum: ${{ steps.build.outputs.checksum }}"
echo "Rubygems checksum: ${{ fromJson(steps.checksum.outputs.geminfo).sha }}"
echo "Gem version: ${{ steps.build.outputs.gem_version }}"
- name: Fail if local and rubygems checksums don't match
if: fromJson(steps.checksum.outputs.geminfo).sha != steps.build.outputs.checksum
Expand All @@ -78,7 +79,7 @@ jobs:
- name: Create release draft that includes the checksum
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
github-token: ${{secrets.CI_GITHUB_TOKEN}}
script: |
github.repos.createRelease({
owner: "solarwindscloud",
Expand All @@ -89,20 +90,12 @@ jobs:
draft: true
})
# may need a bit of time for the gem to become available (-> sleep 1)
may need a bit of time for the gem to become available (-> sleep 1)
- name: Download new Rubygem from rubygems.org and test
working-directory: .github/workflows/
env:
SW_APM_SERVICE_KEY: ${{ secrets.SW_APM_SERVICE_KEY_PROD }}
SW_APM_COLLECTOR: ${{ secrets.SW_APM_COLLECTOR_PROD}}
SW_APM_SERVICE_KEY: ${{ secrets.APM_RUBY_INSTALL_TESTING_SWO_KEY }}
run: |
sleep 1
gem install solarwinds_apm --version ${{ steps.build.outputs.gem_version }}
ruby ./scripts/test_install.rb
- name: Now also check manually if there is a trace for service 'ruby-post-release-test' in SW production
run: echo "TODO"

- name: And now the release notes need to be completed for the new release
run: echo "TODO"

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ rubocop_result.txt

# sample script
git_push.sh

# act.secrets
act.secrets
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def oboe_github_fetch
# fetch files
@files.each do |filename|
uri = URI(File.join(oboe_github, filename).to_s)
uri = URI(File.join(oboe_github, 'swig', filename).to_s) if filename == 'oboe.i'
req = Net::HTTP::Get.new(uri)
req['Authorization'] = "token #{oboe_token}"

Expand Down

0 comments on commit 9a566fa

Please sign in to comment.