Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/version-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Validate and Publish

on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
Expand All @@ -12,7 +13,7 @@ permissions:

jobs:
build:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/v')
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/v'))
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
Expand All @@ -21,16 +22,21 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Extract and validate version from branch name
- name: Extract and validate version
id: extract-version
run: |
VERSION="${GITHUB_HEAD_REF#release/}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="v$(jq -r '.gemVersion' turnkey_client_inputs/config.json)"
echo "Read version from config.json: $VERSION"
else
VERSION="${GITHUB_HEAD_REF#release/}"
echo "Extracted version from branch: $VERSION"
fi
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Branch name does not match expected format release/vX.X.X (got: $GITHUB_HEAD_REF)"
echo "::error::Version does not match expected format vX.X.X (got: $VERSION)"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Extracted version: $VERSION"

# https://github.com/ruby/setup-ruby
- name: Set up Ruby
Expand Down
1 change: 1 addition & 0 deletions turnkey_client/lib/turnkey_client/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def initialize(config)
@default_headers = {
'Content-Type' => 'application/json',
'User-Agent' => @user_agent
'X-Client-Version' => "turnkey-ruby/#{VERSION}"
}

if config.api_public_key.nil?
Expand Down
1 change: 1 addition & 0 deletions turnkey_client_inputs/templates/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module {{moduleName}}
@default_headers = {
'Content-Type' => 'application/json',
'User-Agent' => @user_agent
'X-Client-Version' => "turnkey-ruby/#{VERSION}"
}

if config.api_public_key.nil?
Expand Down
Loading