v1.0.5 #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish | |
| on: | |
| release: | |
| types: [released] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build | |
| - name: Test | |
| run: yarn test | |
| bump-version: | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate GitHub App token | |
| id: generate-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ vars.CLI_GENERATION_APP_ID }} | |
| private-key: ${{ secrets.CLI_GENERATION_APP_PRIVATE_KEY }} | |
| - name: Check out repository code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: | | |
| yarn install --frozen-lockfile | |
| npm i -g auto-changelog | |
| - name: Bump version and add changelog | |
| run: | | |
| initialTag=${{ github.event.release.tag_name }} | |
| tag="${initialTag//[v]/}" | |
| echo $tag | |
| git remote update | |
| git fetch | |
| git checkout --track origin/main | |
| git config --global user.email "github-actions@github.com" | |
| git config --global user.name "Github Actions" | |
| npm --no-git-tag-version --allow-same-version version $tag | |
| auto-changelog | |
| git add . | |
| git commit -m "dump new version $tag" | |
| git push | |
| - name: Move tag | |
| run: | | |
| TAG_NAME=${{ github.event.release.tag_name }} | |
| echo $TAG_NAME | |
| git tag --force $TAG_NAME | |
| git push --force origin $TAG_NAME | |
| pack-tarballs: | |
| needs: bump-version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build | |
| - name: Pack tarballs | |
| run: npx oclif pack tarballs --targets darwin-x64,darwin-arm64,linux-x64,linux-arm64,win32-x64 | |
| - name: Upload tarballs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tarballs | |
| path: dist/*.tar.* | |
| retention-days: 7 | |
| pack-macos: | |
| needs: bump-version | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build | |
| - name: Pack macOS | |
| run: npx oclif pack macos --targets darwin-arm64,darwin-x64 | |
| - name: Upload macOS installers | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos | |
| path: dist/macos/*.pkg | |
| retention-days: 7 | |
| pack-deb: | |
| needs: bump-version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build | |
| - name: Pack deb | |
| run: npx oclif pack deb | |
| - name: Remove unsupported deb architectures | |
| run: rm -f dist/deb/*armel*.deb | |
| - name: Upload deb installer | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-deb | |
| path: dist/deb/*.deb | |
| retention-days: 7 | |
| pack-windows: | |
| needs: bump-version | |
| runs-on: windows-latest | |
| steps: | |
| - name: Enable Windows + Git long paths | |
| shell: pwsh | |
| run: | | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` | |
| -Name LongPathsEnabled -Value 1 -PropertyType DWORD -Force | Out-Null | |
| git config --system core.longpaths true | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build | |
| - name: Add GNU tar to PATH | |
| shell: pwsh | |
| run: echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Install NSIS | |
| shell: pwsh | |
| run: | | |
| choco install nsis -y | |
| echo "C:\Program Files (x86)\NSIS" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Create short junction to workspace | |
| shell: cmd | |
| run: mklink /J C:\c "%GITHUB_WORKSPACE%" | |
| - name: Pack Windows | |
| shell: pwsh | |
| working-directory: C:\c | |
| run: npx oclif pack win --targets win32-x64 | |
| - name: Upload Windows installer | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows | |
| path: dist/win32/*.exe | |
| retention-days: 7 | |
| publish: | |
| needs: [pack-tarballs, pack-macos, pack-deb, pack-windows] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build | |
| - name: Publish package | |
| run: npx --yes npm@^11 publish --access public | |
| # No NODE_AUTH_TOKEN needed - OIDC handles authentication | |
| upload-release-assets: | |
| needs: [pack-tarballs, pack-macos, pack-deb, pack-windows] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download tarballs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tarballs | |
| path: dist/tarballs | |
| - name: Download macOS installers | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos | |
| path: dist/macos | |
| - name: Download deb | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-deb | |
| path: dist/linux-deb | |
| - name: Download Windows | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows | |
| path: dist/windows | |
| - name: Upload assets to GitHub release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_REPO: ${{ github.repository }} | |
| run: | | |
| TAG=${{ github.event.release.tag_name }} | |
| echo "Uploading assets to release $TAG..." | |
| for file in dist/tarballs/* dist/macos/* dist/linux-deb/* dist/windows/*; do | |
| [ -f "$file" ] || continue | |
| echo "Uploading $(basename "$file")..." | |
| gh release upload "$TAG" "$file" --repo "$GH_REPO" --clobber | |
| done | |
| echo "All assets uploaded successfully!" | |
| update-homebrew: | |
| needs: upload-release-assets | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate GitHub App token | |
| id: generate-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ vars.CLI_GENERATION_APP_ID }} | |
| private-key: ${{ secrets.CLI_GENERATION_APP_PRIVATE_KEY }} | |
| owner: fireblocks | |
| - name: Update Homebrew formula | |
| env: | |
| GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| run: | | |
| TAG=${{ github.event.release.tag_name }} | |
| VERSION="${TAG#v}" | |
| BASE_URL="https://github.com/fireblocks/fireblocks-cli/releases/download/${TAG}" | |
| ARM64_FILENAME=$(gh release view "$TAG" --repo fireblocks/fireblocks-cli --json assets -q '.assets[].name | select(test("darwin-arm64.*\\.tar\\.gz$"))' | head -1) | |
| X64_FILENAME=$(gh release view "$TAG" --repo fireblocks/fireblocks-cli --json assets -q '.assets[].name | select(test("darwin-x64.*\\.tar\\.gz$"))' | head -1) | |
| curl -fLo arm64.tar.gz "${BASE_URL}/${ARM64_FILENAME}" | |
| curl -fLo x64.tar.gz "${BASE_URL}/${X64_FILENAME}" | |
| ARM64_SHA256=$(sha256sum arm64.tar.gz | awk '{print $1}') | |
| X64_SHA256=$(sha256sum x64.tar.gz | awk '{print $1}') | |
| git clone "https://x-access-token:${GH_TOKEN}@github.com/fireblocks/homebrew-fireblocks-cli.git" tap | |
| cd tap | |
| git config user.email "github-actions@github.com" | |
| git config user.name "GitHub Actions" | |
| sed -i "s| version \"[^\"]*\"| version \"${VERSION}\"|" Formula/fireblocks-cli.rb | |
| sed -i "s|url \"https://.*darwin-arm64.*\"|url \"${BASE_URL}/${ARM64_FILENAME}\"|" Formula/fireblocks-cli.rb | |
| sed -i "/darwin-arm64/{n;s|sha256 \"[^\"]*\"|sha256 \"${ARM64_SHA256}\"|};" Formula/fireblocks-cli.rb | |
| sed -i "s|url \"https://.*darwin-x64.*\"|url \"${BASE_URL}/${X64_FILENAME}\"|" Formula/fireblocks-cli.rb | |
| sed -i "/darwin-x64/{n;s|sha256 \"[^\"]*\"|sha256 \"${X64_SHA256}\"|};" Formula/fireblocks-cli.rb | |
| git add Formula/fireblocks-cli.rb | |
| git commit -m "Update fireblocks-cli to ${VERSION}" | |
| git push |