-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (39 loc) · 1.14 KB
/
push_gem.yml
File metadata and controls
46 lines (39 loc) · 1.14 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
---
name: Push gem
"on":
workflow_run:
workflows: ["Ruby"]
branches: [main]
types:
- completed
jobs:
push:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ruby
- name: Check if version already exists
id: version-check
run: |
VERSION=$(cat VERSION)
if gem list -r sdk-reforge | grep -q "sdk-reforge ($VERSION)"; then
echo "version-exists=true" >> $GITHUB_OUTPUT
echo "Version $VERSION already exists on RubyGems, skipping publish"
else
echo "version-exists=false" >> $GITHUB_OUTPUT
echo "Version $VERSION not found, proceeding with publish"
fi
- name: Release gem
if: steps.version-check.outputs.version-exists == 'false'
uses: rubygems/release-gem@v1