-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (56 loc) · 1.81 KB
/
Copy pathrelease-ruby.yml
File metadata and controls
65 lines (56 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Release Ruby
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (skip publish)'
required: false
default: true
type: boolean
permissions:
contents: read
id-token: write
jobs:
release:
name: Publish to RubyGems
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ruby/setup-ruby@6ca151fd1bfcfd6fe0c4eb6837eb0584d0134a0c # v1
with:
ruby-version: '3.3'
bundler-cache: true
working-directory: ruby
- name: Test
run: |
cd ruby
bundle exec rake test
bundle exec rubocop
- name: Build gem
run: cd ruby && gem build fizzy-sdk.gemspec
- name: Configure credentials
if: github.event_name == 'push' || inputs.dry_run == false
uses: rubygems/configure-rubygems-credentials@453c77b40e686566dabf4fd7576187f0ef08138f # main
with:
role-to-assume: ${{ secrets.RUBYGEMS_ROLE_ARN }}
- name: Publish
if: github.event_name == 'push' || inputs.dry_run == false
run: |
cd ruby
GEM_FILE=$(ls *.gem | head -1)
gem push "$GEM_FILE" || true
- name: Wait for availability
if: github.event_name == 'push'
run: |
VERSION=$(grep VERSION ruby/lib/fizzy/version.rb | head -1 | sed 's/.*"\(.*\)".*/\1/')
for i in $(seq 1 30); do
if gem info fizzy-sdk -r -v "$VERSION" 2>/dev/null | grep -q "$VERSION"; then
echo "Version $VERSION available"
exit 0
fi
echo "Waiting for $VERSION to appear on RubyGems (attempt $i)..."
sleep 10
done
echo "Timed out waiting for gem availability"