Skip to content

Commit 7e28411

Browse files
cli-generation-automation[bot]fireblocks_dx_team
andauthored
Generated CLI #3663 (#26)
Co-authored-by: fireblocks_dx_team <dx_team@fireblocks.com>
1 parent 9416c27 commit 7e28411

11 files changed

Lines changed: 503 additions & 271 deletions

File tree

.github/workflows/draft-release-from-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
draft-release:
14-
if: "!startsWith(github.event.head_commit.message, 'release ')"
14+
if: "!startsWith(github.event.head_commit.message, 'dump new version ')"
1515
runs-on: ubuntu-latest
1616

1717
steps:

.github/workflows/publish.yml

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
npm --no-git-tag-version --allow-same-version version $tag
6666
auto-changelog
6767
git add .
68-
git commit -m "release $tag"
68+
git commit -m "dump new version $tag"
6969
git push
7070
7171
- name: Move tag
@@ -206,6 +206,20 @@ jobs:
206206
choco install nsis -y
207207
echo "C:\Program Files (x86)\NSIS" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
208208
209+
- name: Patch oclif NSIS template for long PATH support
210+
shell: pwsh
211+
run: |
212+
$nsiTemplate = Get-ChildItem -Path node_modules -Recurse -Filter "*.nsi" -ErrorAction SilentlyContinue | Where-Object { $_.FullName -match "oclif" } | Select-Object -First 1
213+
if ($nsiTemplate) {
214+
$content = Get-Content $nsiTemplate.FullName -Raw
215+
$psCmd = 'nsExec::ExecToLog ''powershell -Command "[Environment]::SetEnvironmentVariable(''Path'', [Environment]::GetEnvironmentVariable(''Path'', ''Machine'') + '';$INSTDIR\bin'', ''Machine'')"'''
216+
$content = $content -replace 'WriteRegExpandStr HKLM[^\n]*PATH[^\n]*', $psCmd
217+
Set-Content $nsiTemplate.FullName $content
218+
Write-Host "Patched $($nsiTemplate.FullName)"
219+
} else {
220+
Write-Host "NSI template not found, skipping patch"
221+
}
222+
209223
- name: Pack Windows
210224
run: npx oclif pack win --targets win32-x64
211225

@@ -303,63 +317,35 @@ jobs:
303317
private-key: ${{ secrets.CLI_GENERATION_APP_PRIVATE_KEY }}
304318
owner: fireblocks
305319

306-
- name: Download tarballs
307-
uses: actions/download-artifact@v4
308-
with:
309-
name: tarballs
310-
path: dist/tarballs
311-
312320
- name: Update Homebrew formula
313321
env:
314322
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
315323
run: |
316324
TAG=${{ github.event.release.tag_name }}
317325
VERSION="${TAG#v}"
318326
319-
ARM64_FILE=$(ls dist/tarballs/*darwin-arm64*.tar.gz | head -1)
320-
X64_FILE=$(ls dist/tarballs/*darwin-x64*.tar.gz | head -1)
327+
BASE_URL="https://github.com/fireblocks/fireblocks-cli/releases/download/${TAG}"
321328
322-
ARM64_SHA256=$(sha256sum "$ARM64_FILE" | awk '{print $1}')
323-
X64_SHA256=$(sha256sum "$X64_FILE" | awk '{print $1}')
329+
ARM64_FILENAME=$(gh release view "$TAG" --repo fireblocks/fireblocks-cli --json assets -q '.assets[].name | select(test("darwin-arm64.*\\.tar\\.gz$"))' | head -1)
330+
X64_FILENAME=$(gh release view "$TAG" --repo fireblocks/fireblocks-cli --json assets -q '.assets[].name | select(test("darwin-x64.*\\.tar\\.gz$"))' | head -1)
324331
325-
BASE_URL="https://github.com/fireblocks/fireblocks-cli/releases/download/${TAG}"
326-
ARM64_FILENAME=$(basename "$ARM64_FILE")
327-
X64_FILENAME=$(basename "$X64_FILE")
332+
curl -fLo arm64.tar.gz "${BASE_URL}/${ARM64_FILENAME}"
333+
curl -fLo x64.tar.gz "${BASE_URL}/${X64_FILENAME}"
334+
335+
ARM64_SHA256=$(sha256sum arm64.tar.gz | awk '{print $1}')
336+
X64_SHA256=$(sha256sum x64.tar.gz | awk '{print $1}')
328337
329338
git clone "https://x-access-token:${GH_TOKEN}@github.com/fireblocks/homebrew-fireblocks-cli.git" tap
330339
cd tap
331340
332341
git config user.email "github-actions@github.com"
333342
git config user.name "GitHub Actions"
334343
335-
mkdir -p Formula
336-
cat > Formula/fireblocks-cli.rb << FORMULA
337-
class FireblocksCli < Formula
338-
desc "Agent-first CLI for Fireblocks infrastructure"
339-
homepage "https://github.com/fireblocks/fireblocks-cli"
340-
version "${VERSION}"
341-
license "MIT"
342-
343-
on_macos do
344-
if Hardware::CPU.arm?
345-
url "${BASE_URL}/${ARM64_FILENAME}"
346-
sha256 "${ARM64_SHA256}"
347-
else
348-
url "${BASE_URL}/${X64_FILENAME}"
349-
sha256 "${X64_SHA256}"
350-
end
351-
end
352-
353-
def install
354-
libexec.install Dir["*"]
355-
bin.write_exec_script libexec/"bin/fireblocks"
356-
end
357-
358-
test do
359-
assert_match version.to_s, shell_output("#{bin}/fireblocks --version")
360-
end
361-
end
362-
FORMULA
344+
sed -i "s| version \"[^\"]*\"| version \"${VERSION}\"|" Formula/fireblocks-cli.rb
345+
sed -i "s|url \"https://.*darwin-arm64.*\"|url \"${BASE_URL}/${ARM64_FILENAME}\"|" Formula/fireblocks-cli.rb
346+
sed -i "/darwin-arm64/{n;s|sha256 \"[^\"]*\"|sha256 \"${ARM64_SHA256}\"|};" Formula/fireblocks-cli.rb
347+
sed -i "s|url \"https://.*darwin-x64.*\"|url \"${BASE_URL}/${X64_FILENAME}\"|" Formula/fireblocks-cli.rb
348+
sed -i "/darwin-x64/{n;s|sha256 \"[^\"]*\"|sha256 \"${X64_SHA256}\"|};" Formula/fireblocks-cli.rb
363349
364350
git add Formula/fireblocks-cli.rb
365351
git commit -m "Update fireblocks-cli to ${VERSION}"

CHANGELOG.md

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)