Skip to content

Commit 68d08b6

Browse files
committed
split rubygems/terraform workflows
1 parent 92aade2 commit 68d08b6

1 file changed

Lines changed: 57 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ jobs:
8686
echo "Timed out waiting for CI to complete."
8787
exit 1
8888
89-
sync:
90-
name: Release gem and sync provider
89+
gem:
90+
name: Publish RubyGem
9191
needs: wait_ci
9292
runs-on: ubuntu-latest
9393
env:
9494
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' && 'true' || 'false' }}
9595
TAG_NAME: ${{ github.ref_type == 'tag' && github.ref_name || github.event.release.tag_name }}
9696
steps:
97-
- name: Checkout logstruct
97+
- name: Checkout
9898
uses: actions/checkout@v4
9999
with:
100100
fetch-depth: 0
@@ -105,16 +105,6 @@ jobs:
105105
ruby-version: '.ruby-version'
106106
bundler-cache: true
107107

108-
- name: Setup Node (for pnpm cache if needed)
109-
uses: actions/setup-node@v4
110-
with:
111-
node-version: 20
112-
113-
- name: Setup pnpm
114-
uses: pnpm/action-setup@v4
115-
with:
116-
version: latest
117-
118108
- name: Determine version and validate tag
119109
id: ver
120110
shell: bash
@@ -144,10 +134,6 @@ jobs:
144134
exit 1
145135
fi
146136
147-
- name: Generate site exports (enums/structs/keys)
148-
run: |
149-
ruby scripts/export_typescript_types.rb
150-
151137
- name: Build gem
152138
run: |
153139
gem build logstruct.gemspec
@@ -175,10 +161,9 @@ jobs:
175161
if [[ -f "$GEM_FILE" ]]; then
176162
echo "Using gem file: $GEM_FILE"
177163
elif [[ -f "$ALT_GEM_FILE" ]]; then
178-
echo "Using gem file: $ALT_GEM_FILE (Bundler prerelease normalization)"
164+
echo "Using gem file: $ALT_GEM_FILE (RubyGems prerelease normalization)"
179165
GEM_FILE="$ALT_GEM_FILE"
180166
else
181-
# Fallback: pick the most recent built gem that matches the version prefix
182167
CANDIDATE=$(ls -1t logstruct-*.gem 2>/dev/null | head -n1 || true)
183168
if [[ -n "$CANDIDATE" ]]; then
184169
echo "Falling back to: $CANDIDATE"
@@ -202,6 +187,57 @@ jobs:
202187
fi
203188
echo "[DRY-RUN] Would push gem $CANDIDATE to RubyGems"
204189
190+
provider:
191+
name: Sync + Tag Provider
192+
needs: wait_ci
193+
runs-on: ubuntu-latest
194+
env:
195+
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' && 'true' || 'false' }}
196+
TAG_NAME: ${{ github.ref_type == 'tag' && github.ref_name || github.event.release.tag_name }}
197+
steps:
198+
- name: Checkout
199+
uses: actions/checkout@v4
200+
with:
201+
fetch-depth: 0
202+
203+
- name: Setup Ruby
204+
uses: ruby/setup-ruby@v1
205+
with:
206+
ruby-version: '.ruby-version'
207+
bundler-cache: true
208+
209+
- name: Determine version and validate tag
210+
id: ver
211+
shell: bash
212+
run: |
213+
TAG="${TAG_NAME:-}"
214+
if [[ -z "$TAG" ]]; then
215+
echo "No tag resolved; using release event tag." >&2
216+
TAG="${{ github.event.release.tag_name }}"
217+
fi
218+
if [[ -z "$TAG" ]]; then
219+
if [[ "$DRY_RUN" == "true" ]]; then
220+
TAG="v0.0.0-dryrun"
221+
echo "DRY-RUN: Using placeholder tag $TAG" >&2
222+
else
223+
echo "Error: Could not determine tag name from event." >&2
224+
exit 1
225+
fi
226+
fi
227+
VERSION_FROM_TAG="${TAG#v}"
228+
VERSION_RB=$(ruby -e 'print File.read("lib/log_struct/version.rb")[/VERSION\s*=\s*"([^"]+)"/,1]')
229+
echo "tag=$TAG" >> $GITHUB_OUTPUT
230+
echo "version_tag=$VERSION_FROM_TAG" >> $GITHUB_OUTPUT
231+
echo "version_rb=$VERSION_RB" >> $GITHUB_OUTPUT
232+
echo "Resolved tag: $TAG (version $VERSION_FROM_TAG); code version: $VERSION_RB"
233+
if [[ "$DRY_RUN" != "true" && "$VERSION_FROM_TAG" != "$VERSION_RB" ]]; then
234+
echo "::error::Tag version ($VERSION_FROM_TAG) does not match lib/log_struct/version.rb ($VERSION_RB). Update version.rb before tagging, or run as dry-run."
235+
exit 1
236+
fi
237+
238+
- name: Generate site exports (enums/structs/keys)
239+
run: ruby scripts/export_typescript_types.rb
240+
205241
- name: Clone terraform-provider-logstruct repository
206242
env:
207243
PUSH_TOKEN: ${{ secrets.PROVIDER_PUSH_TOKEN }}
@@ -212,13 +248,13 @@ jobs:
212248
git clone https://x-access-token:${PUSH_TOKEN}@github.com/DocSpring/terraform-provider-logstruct.git terraform-provider-logstruct
213249
214250
- name: Export provider catalog (embedded Go data)
215-
run: |
216-
ruby scripts/export_provider_catalog.rb
251+
run: ruby scripts/export_provider_catalog.rb
217252

218253
- name: Build provider to validate catalog
219254
uses: actions/setup-go@v5
220255
with:
221256
go-version: '1.22'
257+
222258
- name: Compile
223259
run: |
224260
cd terraform-provider-logstruct

0 commit comments

Comments
 (0)