rrtrace 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4a124628bbb1039ea27c48968665bf6959431debeeba3068fca7525e7a4e47c2
4
+ data.tar.gz: 8b1e21f4b384326c82f59e6f43739a4be18c3463a0f461b7f4375523696488ae
5
+ SHA512:
6
+ metadata.gz: 32a443232b6937c43efd666a635347484da22c5d67da40c7c1ed23b31ccfb08a750af48f49a2182061acb842bdf837c0df763b120f9f550726d739731f7669d0
7
+ data.tar.gz: d73f389d094a12cad5d73c34ec8727d939ec98f6c5b2fe5b6a74f98bc25021fccae41c561a30c787a09eea90241c8812d32cc743f4ceccd825864695753616b5
@@ -0,0 +1,137 @@
1
+ name: Build and Release
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ name: Build on ${{ matrix.os }}
8
+ runs-on: ${{ matrix.os }}
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ os: [ ubuntu-latest, macos-latest, windows-latest ]
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: '4.0'
21
+ bundler-cache: true
22
+
23
+ - name: Set up Rust
24
+ uses: dtolnay/rust-toolchain@stable
25
+
26
+ - name: Get version
27
+ id: get_version
28
+ shell: bash
29
+ run: |
30
+ set -euo pipefail
31
+
32
+ VERSION=$(ruby -Ilib -r rrtrace/version -e 'puts Rrtrace::VERSION')
33
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
34
+
35
+ - name: Build native gem
36
+ run: bundle exec rake native gem
37
+
38
+ - name: Build source gem
39
+ if: matrix.os == 'ubuntu-latest'
40
+ shell: bash
41
+ run: |
42
+ set -euo pipefail
43
+
44
+ gem build rrtrace.gemspec
45
+ mkdir -p pkg
46
+ mv rrtrace-${{ steps.get_version.outputs.version }}.gem pkg/
47
+
48
+ - name: Upload artifacts
49
+ uses: actions/upload-artifact@v4
50
+ with:
51
+ name: gems-${{ matrix.os }}
52
+ path: pkg/*.gem
53
+
54
+ release:
55
+ name: Release Gems
56
+ needs: build
57
+ if: github.ref_name == github.event.repository.default_branch
58
+ runs-on: ubuntu-latest
59
+ permissions:
60
+ id-token: write
61
+ contents: write
62
+ steps:
63
+ - uses: actions/checkout@v4
64
+
65
+ - name: Set up Ruby
66
+ uses: ruby/setup-ruby@v1
67
+ with:
68
+ ruby-version: '4.0'
69
+ bundler-cache: true
70
+
71
+ - name: Download artifacts
72
+ uses: actions/download-artifact@v4
73
+ with:
74
+ path: pkg
75
+ merge-multiple: true
76
+
77
+ - name: Configure RubyGems credentials
78
+ uses: rubygems/configure-rubygems-credentials@v1.0.0
79
+
80
+ - name: Get version
81
+ id: get_version
82
+ shell: bash
83
+ run: |
84
+ set -euo pipefail
85
+ VERSION=$(ruby -Ilib -r rrtrace/version -e 'puts Rrtrace::VERSION')
86
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
87
+
88
+ - name: Publish to RubyGems
89
+ shell: bash
90
+ run: |
91
+ set -euo pipefail
92
+
93
+ VERSION=${{ steps.get_version.outputs.version }}
94
+
95
+ # Fetch published versions from RubyGems API
96
+ echo "Fetching published versions for rrtrace..."
97
+ PUBLISHED_VERSIONS=$(curl -s https://rubygems.org/api/v1/versions/rrtrace.json)
98
+ if ! echo "$PUBLISHED_VERSIONS" | jq -e 'type == "array"' >/dev/null 2>&1; then
99
+ PUBLISHED_VERSIONS="[]"
100
+ fi
101
+
102
+ PUBLISHED_COUNT=0
103
+
104
+ for gem_file in pkg/*.gem; do
105
+ if [ ! -f "$gem_file" ]; then continue; fi
106
+ GEM_FILENAME=$(basename $gem_file)
107
+ PLATFORM=$(echo $GEM_FILENAME | sed -E "s/rrtrace-$VERSION-?//; s/\.gem$//")
108
+ if [ -z "$PLATFORM" ]; then PLATFORM="ruby"; fi
109
+
110
+ echo "Checking if $GEM_FILENAME (platform: $PLATFORM) is already published..."
111
+
112
+ if echo "$PUBLISHED_VERSIONS" | jq -e ".[] | select(.number == \"$VERSION\" and .platform == \"$PLATFORM\")" > /dev/null 2>&1; then
113
+ echo "$GEM_FILENAME is already published. Skipping."
114
+ else
115
+ echo "Publishing $GEM_FILENAME..."
116
+ gem push $gem_file
117
+ PUBLISHED_COUNT=$((PUBLISHED_COUNT + 1))
118
+ fi
119
+ done
120
+
121
+ echo "PUBLISHED_COUNT=$PUBLISHED_COUNT" >> $GITHUB_ENV
122
+
123
+ - name: Create Tag
124
+ if: env.PUBLISHED_COUNT != '0'
125
+ shell: bash
126
+ run: |
127
+ set -euo pipefail
128
+ VERSION="v${{ steps.get_version.outputs.version }}"
129
+ if git rev-parse "$VERSION" >/dev/null 2>&1; then
130
+ echo "Tag $VERSION already exists."
131
+ else
132
+ echo "Creating and pushing tag $VERSION..."
133
+ git config user.name "github-actions[bot]"
134
+ git config user.email "github-actions[bot]@users.noreply.github.com"
135
+ git tag "$VERSION"
136
+ git push origin "$VERSION"
137
+ fi