-
Notifications
You must be signed in to change notification settings - Fork 129
chore: update prep for releasing ESM and yargs-based CLI as version 2.0 #806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rossiam
merged 1 commit into
SmartThingsCommunity:main
from
rossiam:final-yargs-esm-release-prep
Dec 22, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@smartthings/cli": major | ||
| --- | ||
|
|
||
| refactor to use yargs |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ on: | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| jobs: | ||
| release: | ||
| npm-release: | ||
| # don't run on forks | ||
| if: ${{ github.repository_owner == 'SmartThingsCommunity' }} | ||
|
|
||
|
|
@@ -17,16 +17,15 @@ jobs: | |
| runs-on: ubuntu-latest | ||
|
|
||
| outputs: | ||
| cli-released: ${{ steps.cli-release.outputs.published }} | ||
| cli-version: ${{ steps.cli-metadata.outputs.version }} | ||
| cli-tag: ${{ steps.cli-metadata.outputs.tag }} | ||
|
|
||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v6.0.1 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v3 | ||
| uses: actions/setup-node@v6.1.0 | ||
| with: | ||
| node-version: 24.8.0 | ||
|
|
||
|
|
@@ -35,7 +34,7 @@ jobs: | |
|
|
||
| - name: Create Release Pull Request or Publish to npm | ||
| id: changesets | ||
| uses: changesets/action@v1 | ||
| uses: changesets/action@v1.5.3 | ||
| with: | ||
| version: npm run version | ||
| publish: npm run release | ||
|
|
@@ -46,42 +45,34 @@ jobs: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| # decouple Github Release from library-only publishing | ||
| - name: Check if CLI Published | ||
| id: cli-release | ||
| run: echo "published=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq 'any(.name == "@smartthings/cli")')" >> $GITHUB_OUTPUT | ||
| - name: Debug Published Packages | ||
| run: | | ||
| echo "Published Packages:" | ||
| echo '${{ steps.changesets.outputs.publishedPackages }}' | jq . | ||
|
|
||
| - name: Derive Required Metadata | ||
| id: cli-metadata | ||
| if: steps.cli-release.outputs.published == 'true' | ||
| run: | # derive latest info from changesets output | ||
| PUBLISHED_PACKAGE=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq 'map(select(.name == "@smartthings/cli")) | .[]') | ||
| echo "tag=$(echo $PUBLISHED_PACKAGE | jq --raw-output '.name + "@" + .version')" >> $GITHUB_OUTPUT | ||
| echo "version=$(echo $PUBLISHED_PACKAGE | jq --raw-output '.version')" >> $GITHUB_OUTPUT | ||
| published_package=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq 'map(select(.name == "@smartthings/cli")) | .[]') | ||
| echo "tag=$(echo $published_package | jq --raw-output '.name + "@" + .version')" >> $GITHUB_OUTPUT | ||
| echo "version=$(echo $published_package | jq --raw-output '.version')" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Debug Version | ||
| run: | | ||
| echo "CLI Tag: ${{ steps.cli-metadata.outputs.tag }}" | ||
| echo "CLI Version: ${{ steps.cli-metadata.outputs.version }}" | ||
|
|
||
| package: | ||
| name: Package CLI | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Install and Setup QEMU | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install binfmt-support qemu-user-static | ||
|
|
||
| # see https://github.com/vercel/pkg/issues/1251#issuecomment-1024832725 | ||
| - name: Download and Install ldid Codesign Utility | ||
| run: | | ||
| wget https://github.com/jesec/ldid-static/releases/download/v2.1.4/ldid-amd64 | ||
| chmod +x ldid-amd64 | ||
| sudo mv ldid-amd64 /usr/local/bin/ldid | ||
|
|
||
| - name: Checkout Repo | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v6.0.1 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v3 | ||
| uses: actions/setup-node@v6.1.0 | ||
| with: | ||
| node-version: 24.8.0 | ||
|
|
||
|
|
@@ -91,16 +82,21 @@ jobs: | |
| - name: Package CLI | ||
| run: npm run package | ||
|
|
||
| # maintain executable file permissions | ||
| # see https://github.com/actions/upload-artifact/issues/38 | ||
| - name: Tar files | ||
| run: tar -cvf dist_bin.tar packages/cli/dist_bin/ | ||
| - name: Debug List Files after Packaging | ||
| run: ls -lR dist_bin | ||
|
|
||
| - name: Upload Artifacts | ||
| uses: actions/upload-artifact@v4.4.0 | ||
| id: upload-artifacts | ||
| uses: actions/upload-artifact@v6.0.0 | ||
| with: | ||
| name: dist_bin | ||
| path: dist_bin.tar | ||
| name: Binaries | ||
| path: | | ||
| dist_bin/*.tgz | ||
| dist_bin/*.zip | ||
|
|
||
| - name: Debug Artifact Ids | ||
| run: | | ||
| echo "Artifact Id: ${{ steps.upload-artifacts.outputs.artifact-id }}" | ||
|
|
||
| functional-test: | ||
| needs: package | ||
|
|
@@ -115,111 +111,126 @@ jobs: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v6.0.1 | ||
|
|
||
| - name: Download Artifacts | ||
| uses: actions/download-artifact@v4.1.8 | ||
| - name: Download Binaries | ||
| uses: actions/download-artifact@v7.0.0 | ||
| with: | ||
| name: dist_bin | ||
| name: Binaries | ||
|
|
||
| - name: Debug List Files after Download, Windows | ||
| if: runner.os == 'Windows' | ||
| run: Get-ChildItem -Path dist_bin | ||
|
|
||
| - name: Debug List Files after Download | ||
| if: runner.os != 'Windows' | ||
| run: ls -l dist_bin | ||
|
|
||
| - name: Extract Linux Binary | ||
| if: runner.os == 'Linux' | ||
| run: tar xvf dist_bin/smartthings-linux-x64.tgz | ||
|
|
||
| - name: Extract MacOS Binary | ||
| if: runner.os == 'macOS' | ||
| run: tar xvf dist_bin/smartthings-mac-arm64.tgz | ||
|
|
||
| - name: Extract Artifacts | ||
| run: tar -xvf dist_bin.tar | ||
| - name: Extract Windows Binary | ||
| if: runner.os == 'Windows' | ||
| run: Expand-Archive -Path dist_bin\smartthings-windows-x64.zip -DestinationPath "${{ github.workspace }}" | ||
|
|
||
| - uses: actions/setup-python@v4 | ||
| - uses: actions/setup-python@v6.1.0 | ||
| with: | ||
| python-version: '3.11.5' | ||
| python-version: '3.14.2' | ||
| cache: 'pip' | ||
|
|
||
| # make sure 'smartthings' is available to child processes | ||
| - name: Debug List Files after Extraction, Windows | ||
| if: runner.os == 'Windows' | ||
| run: Get-ChildItem | ||
|
|
||
| - name: Debug List Files after Extraction | ||
| if: runner.os != 'Windows' | ||
| run: ls -l | ||
|
|
||
| # Make sure 'smartthings' binary is available to child processes (i.e. included in PATH). | ||
| - name: Set Windows Path | ||
| if: runner.os == 'Windows' | ||
| run: Add-Content $env:GITHUB_PATH "${{ github.workspace }}\packages\cli\dist_bin\win\x64" | ||
| - name: Set macOS Path | ||
| if: runner.os == 'macOS' | ||
| run: echo "$GITHUB_WORKSPACE/packages/cli/dist_bin/macos/x64" >> $GITHUB_PATH | ||
| - name: Set Linux Path | ||
| if: runner.os == 'Linux' | ||
| run: echo "$GITHUB_WORKSPACE/packages/cli/dist_bin/linux/x64" >> $GITHUB_PATH | ||
| run: Add-Content $env:GITHUB_PATH "${{ github.workspace }}" | ||
| - name: Set Path | ||
| if: runner.os != 'Windows' | ||
| run: echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH | ||
|
|
||
| - name: Install Dependencies and Run Tests | ||
| working-directory: functional-tests | ||
| run: | | ||
| python -m pip install --force-reinstall -v pip==23.3.1 | ||
| python -m pip install --force-reinstall -v pip==25.3 | ||
| pip install -r requirements.txt | ||
| pytest | ||
| working-directory: packages/cli/functional-tests | ||
|
|
||
| github-release: | ||
| needs: [release, package] | ||
|
|
||
| if: needs.release.outputs.cli-released == 'true' | ||
| needs: [npm-release, package] | ||
|
|
||
| name: Create Github Release | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Debug Version | ||
| run: | | ||
| echo "CLI Version: ${{ needs.npm-release.outputs.cli-version }}" | ||
| echo "CLI Tag: ${{ needs.npm-release.outputs.cli-tag }}" | ||
|
|
||
| - name: Checkout Repo | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v6.0.1 | ||
|
|
||
| - name: Download Artifacts | ||
| uses: actions/download-artifact@v4.1.8 | ||
| uses: actions/download-artifact@v7.0.0 | ||
| with: | ||
| name: dist_bin | ||
| name: Binaries | ||
|
|
||
| - name: Extract Artifacts | ||
| run: tar -xvf dist_bin.tar | ||
| - name: Debug Downloaded Artifacts | ||
| run: ls -l dist_bin/smartthings-*.{tgz,zip} | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v3 | ||
| uses: actions/setup-node@v6.1.0 | ||
| with: | ||
| node-version: 24.8.0 | ||
|
|
||
| - run: npm ci | ||
|
|
||
| # hack since Github auto generated notes aren't working right now | ||
| - name: Generate Github Release Notes | ||
| run: node generate-release-notes.mjs ${{ needs.release.outputs.cli-version }} | ||
|
|
||
| - name: Create Github Release | ||
| uses: softprops/action-gh-release@v1 | ||
| uses: softprops/action-gh-release@v2.5.0 | ||
| with: | ||
| name: ${{ needs.release.outputs.cli-version }} | ||
| body_path: ${{ github.workspace }}/RELEASE_NOTES.txt | ||
| tag_name: ${{ needs.release.outputs.cli-tag }} | ||
| name: ${{ needs.npm-release.outputs.cli-version }} | ||
| tag_name: ${{ needs.npm-release.outputs.cli-tag }} | ||
| generate_release_notes: true | ||
| prerelease: false | ||
| files: 'packages/cli/dist_bin/**/*.@(tgz|zip)' | ||
| files: 'dist_bin/smartthings-*.{tgz,zip}' | ||
|
|
||
| homebrew-formula: | ||
| needs: [release, github-release] | ||
|
|
||
| if: needs.release.outputs.cli-released == 'true' | ||
| needs: [npm-release, github-release] | ||
|
|
||
| name: Bump Homebrew Formula | ||
|
|
||
| runs-on: macos-latest | ||
|
|
||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v6.0.1 | ||
|
|
||
| - name: Configure Git Identity | ||
| uses: Homebrew/actions/git-user-config@master | ||
| uses: Homebrew/actions/git-user-config@main | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's gross that we have to use |
||
| with: | ||
| username: smartthingspi | ||
|
|
||
| - name: Tap Formula Repo | ||
| run: brew tap smartthingscommunity/smartthings | ||
|
|
||
| - name: Bump Formula | ||
| uses: Homebrew/actions/bump-formulae@master | ||
| uses: Homebrew/actions/bump-packages@main | ||
| with: | ||
| token: ${{ secrets.HOMEBREW_COMMITTER_TOKEN }} | ||
| formulae: smartthingscommunity/smartthings/smartthings | ||
|
|
||
| windows-installer: | ||
| needs: [release, package, github-release] | ||
|
|
||
| if: needs.release.outputs.cli-released == 'true' | ||
| needs: [npm-release, package, github-release] | ||
|
|
||
| name: Release Windows Installer | ||
|
|
||
|
|
@@ -228,29 +239,33 @@ jobs: | |
| runs-on: windows-2022 | ||
|
|
||
| steps: | ||
| - name: Print needs.release.outputs.cli-version | ||
| run: Write-Output ${{ needs.release.outputs.cli-version }} | ||
| - name: Print needs.npm-release.outputs.cli-version | ||
| run: Write-Output ${{ needs.npm-release.outputs.cli-version }} | ||
|
|
||
| # remove any pre-release labels since WiX doesn't support them | ||
| - name: Sanitize CLI Version String | ||
| id: safe-semver | ||
| run: echo "version=$('${{ needs.release.outputs.cli-version }}'.Split('-') | Select-Object -Index 0)" >> $env:GITHUB_OUTPUT | ||
| run: echo "version=$('${{ needs.npm-release.outputs.cli-version }}'.Split('-') | Select-Object -Index 0)" >> $env:GITHUB_OUTPUT | ||
|
|
||
| - name: Print steps.safe-semver.outputs.version | ||
| run: Write-Output ${{ steps.safe-semver.outputs.version }} | ||
|
|
||
| - name: Checkout Repo | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v6.0.1 | ||
|
|
||
| - name: Download Artifacts | ||
| uses: actions/download-artifact@v4.1.8 | ||
| uses: actions/download-artifact@v7.0.0 | ||
| with: | ||
| name: dist_bin | ||
| name: Binaries | ||
|
|
||
| - name: Debug List Files after Download | ||
| run: Get-ChildItem -Path dist_bin | ||
|
|
||
| - name: Extract Artifacts | ||
| run: tar -xvf dist_bin.tar | ||
| - name: Extract Windows Binary | ||
| run: Expand-Archive -Path dist_bin\smartthings-windows-x64.zip -DestinationPath "${{ github.workspace }}\wix" | ||
|
|
||
| - run: mv packages\cli\dist_bin\win\x64\smartthings.exe packages\cli\wix | ||
| - name: Debug List Files after Extraction | ||
| run: Get-ChildItem -Path .\wix | ||
|
|
||
| # https://github.community/t/set-path-for-wix-toolset-in-windows-runner/154708/2 | ||
| # https://stackoverflow.com/a/71579543 | ||
|
|
@@ -259,18 +274,18 @@ jobs: | |
|
|
||
| - name: Compile WiX file | ||
| run: candle.exe smartthings.wxs -ext WixUIExtension -arch x64 | ||
| working-directory: packages\cli\wix | ||
| working-directory: wix | ||
| env: | ||
| SMARTTHINGS_SEMVER: ${{ steps.safe-semver.outputs.version }} | ||
| # must be absolute path or relative to .wxs file | ||
| SMARTTHINGS_BINARY_PATH: .\smartthings.exe | ||
|
|
||
| - name: Build .msi | ||
| run: light.exe -out smartthings.msi smartthings.wixobj -ext WixUIExtension | ||
| working-directory: packages\cli\wix | ||
| working-directory: wix | ||
|
|
||
| - name: Add .msi Artifact to Github Release | ||
| uses: softprops/action-gh-release@v1 | ||
| uses: softprops/action-gh-release@v2.5.0 | ||
| with: | ||
| tag_name: ${{ needs.release.outputs.cli-tag }} | ||
| files: packages/cli/wix/smartthings.msi | ||
| tag_name: ${{ needs.npm-release.outputs.cli-tag }} | ||
| files: wix/smartthings.msi | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the new version is less specific about what's being added to the path--now it seems to add the whole Github workspace, whereas previously it added a specific child directory. Is this intended? Are there potential consequences to adding the whole parent directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PATHdirectories are not recursive so this is just a different directory rather than being less specific. The change is needed because now the binary is just unzipped directly into the main workspace directory.