Skip to content
Merged
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
48 changes: 41 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,63 @@ permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- run: go vet ./...
- run: go test ./...
- run: go build ./...

test:
release-build:
name: Release binary build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- run: go test ./...
- run: ./build.sh
env:
VERSION: ci
- run: ./packaging/package-release.sh ci

build:
runs-on: ubuntu-latest
chocolatey:
name: Chocolatey package
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- run: ./build.sh
- name: Build Windows binary
shell: pwsh
run: |
New-Item -ItemType Directory -Force dist | Out-Null
go build -ldflags "-s -w -X main.version=0.0.1" -o dist/dbxcli-windows-amd64.exe .
- name: Package Windows archive
shell: bash
env:
TARGETS: windows/amd64
run: ./packaging/package-release.sh 0.0.1
- name: Pack and install Chocolatey package
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
$zip = Resolve-Path .\dist\dbxcli_0.0.1_windows_amd64.zip
$checksum = (Get-FileHash $zip -Algorithm SHA256).Hash.ToLowerInvariant()
choco pack .\packaging\chocolatey\dbxcli\dbxcli.nuspec --version 0.0.1 --outputdirectory .\dist
$env:DBXCLI_CHOCOLATEY_URL64 = $zip.Path
$env:DBXCLI_CHOCOLATEY_CHECKSUM64 = $checksum
choco install dbxcli --source (Resolve-Path .\dist).Path --version 0.0.1 -y --no-progress
dbxcli --help
choco uninstall dbxcli -y --no-progress
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ jobs:
go-version: "1.25"
- run: go vet ./...
- run: go test ./...
- run: go build ./...
- run: ./build.sh
env:
TRAVIS_TAG: ${{ github.ref_name }}
VERSION: ${{ github.ref_name }}
- run: ./packaging/package-release.sh
env:
VERSION: ${{ github.ref_name }}
- uses: softprops/action-gh-release@v3
with:
files: dist/*
files: |
dist/*.tar.gz
dist/*.zip
dist/SHA256SUMS
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.idea
/dbxcli
/dist/
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,20 @@

## Installation

Download pre-compiled binaries for Mac, Windows and Linux from the [releases](https://github.com/dropbox/dbxcli/releases) page.
Download release archives for Mac, Windows and Linux from the [releases](https://github.com/dropbox/dbxcli/releases) page.

### Mac OSX Installation of pre-compiled binaries
Release assets use these names, where `X.Y.Z` is the release version without the leading `v`:

* `dbxcli_X.Y.Z_darwin_amd64.tar.gz`
* `dbxcli_X.Y.Z_darwin_arm64.tar.gz`
* `dbxcli_X.Y.Z_linux_amd64.tar.gz`
* `dbxcli_X.Y.Z_linux_arm64.tar.gz`
* `dbxcli_X.Y.Z_linux_arm.tar.gz`
* `dbxcli_X.Y.Z_openbsd_amd64.tar.gz`
* `dbxcli_X.Y.Z_windows_amd64.zip`
* `SHA256SUMS`

### macOS installation from release archives
These instructions aim to help both experts and novice `dbxcli` users. Please submit an issue if they don't work for you.

1. Make sure you download and place the binary in a folder that's on your `$PATH`. If you are unsure what this means, go to *step 2*. Otherwise, skip to *step 3*
Expand All @@ -36,10 +47,13 @@ $ cd ~/bin
```sh
export PATH=$PATH:$HOME/bin
```
4. Download the `dbxcli` binary for OSX and rename it. *IMPORTANT:* Check that the tag `v3.2.1` on the URL below is the latest release tag on the [Releases](https://github.com/dropbox/dbxcli/releases) page.
4. Download the `dbxcli` archive for your Mac architecture and unpack it. Replace `X.Y.Z` with the latest release tag from the [Releases](https://github.com/dropbox/dbxcli/releases) page, without the leading `v`.
```sh
$ wget https://github.com/dropbox/dbxcli/releases/download/v3.2.1/dbxcli-darwin-amd64
$ mv dbxcli-darwin-amd64 dbxcli
$ curl -LO https://github.com/dropbox/dbxcli/releases/download/vX.Y.Z/dbxcli_X.Y.Z_darwin_amd64.tar.gz
$ curl -LO https://github.com/dropbox/dbxcli/releases/download/vX.Y.Z/SHA256SUMS
$ grep 'dbxcli_X.Y.Z_darwin_amd64.tar.gz' SHA256SUMS | shasum -a 256 -c -
$ tar -xzf dbxcli_X.Y.Z_darwin_amd64.tar.gz
$ mv dbxcli_X.Y.Z_darwin_amd64/dbxcli dbxcli
```
5. Finally, make the binary an executable file and you are good to go!
```
Expand Down
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

set -e

VERSION="${TRAVIS_TAG:-${GITHUB_REF_NAME:-dev}}"
RAW_VERSION="${VERSION:-${TRAVIS_TAG:-${GITHUB_REF_NAME:-dev}}}"
VERSION="${RAW_VERSION#v}"
LDFLAGS="-s -w -X main.version=${VERSION}"

TARGETS="darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 linux/arm openbsd/amd64 windows/amd64"
Expand Down
16 changes: 16 additions & 0 deletions packaging/chocolatey/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Chocolatey package validation

The public Chocolatey package uses the Windows release archive and its SHA256 checksum.

Before submitting a new version:

1. Publish a GitHub Release with `dbxcli_<version>_windows_amd64.zip` and `SHA256SUMS`.
2. Copy the Windows archive checksum into `tools/chocolateyInstall.ps1`.
3. Pack and test locally on Windows:
```powershell
choco pack packaging\chocolatey\dbxcli\dbxcli.nuspec --version <version> --outputdirectory dist
choco install dbxcli --source dist --version <version> -y
dbxcli --help
choco uninstall dbxcli -y
```
4. Push the resulting `.nupkg` to the Chocolatey community repository.
29 changes: 29 additions & 0 deletions packaging/chocolatey/dbxcli/dbxcli.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>dbxcli</id>
<version>0.0.0</version>
<packageSourceUrl>https://github.com/dropbox/dbxcli</packageSourceUrl>
<owners>Dropbox</owners>
<title>dbxcli</title>
<authors>Dropbox</authors>
<projectUrl>https://github.com/dropbox/dbxcli</projectUrl>
<projectSourceUrl>https://github.com/dropbox/dbxcli</projectSourceUrl>
<docsUrl>https://github.com/dropbox/dbxcli#readme</docsUrl>
<bugTrackerUrl>https://github.com/dropbox/dbxcli/issues</bugTrackerUrl>
<licenseUrl>https://github.com/dropbox/dbxcli/blob/master/LICENSE</licenseUrl>
<releaseNotes>https://github.com/dropbox/dbxcli/releases</releaseNotes>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>Command-line tool for Dropbox users and team admins.</summary>
<description>
dbxcli is an unofficial command-line client for Dropbox users and team admins.
It supports common file operations, account information, sharing commands, and
team administration workflows.
</description>
<tags>dropbox dbxcli cli files sync team-admin</tags>
</metadata>
<files>
<file src="tools\**" target="tools" />
<file src="legal\**" target="legal" />
</files>
</package>
13 changes: 13 additions & 0 deletions packaging/chocolatey/dbxcli/legal/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2016 Dropbox

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
16 changes: 16 additions & 0 deletions packaging/chocolatey/dbxcli/tools/VERIFICATION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
VERIFICATION

This package downloads the official dbxcli Windows release archive from:

https://github.com/dropbox/dbxcli/releases

For each package version:

1. Download dbxcli_<version>_windows_amd64.zip.
2. Download SHA256SUMS from the same GitHub Release.
3. Verify that the archive checksum matches the SHA256SUMS entry.
4. Use that checksum as checksum64 in tools/chocolateyInstall.ps1.

The package source is available at:

https://github.com/dropbox/dbxcli
75 changes: 75 additions & 0 deletions packaging/chocolatey/dbxcli/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
$ErrorActionPreference = 'Stop'

$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$packageName = $env:ChocolateyPackageName
$packageVersion = $env:ChocolateyPackageVersion

$url64 = "https://github.com/dropbox/dbxcli/releases/download/v$packageVersion/dbxcli_${packageVersion}_windows_amd64.zip"
$checksum64 = "__WINDOWS_AMD64_SHA256__"

function Install-DbxcliExe {
$rootExePath = Join-Path $toolsDir 'dbxcli.exe'
if (Test-Path -LiteralPath $rootExePath) {
return
}

$archiveExePath = Join-Path $toolsDir "dbxcli_${packageVersion}_windows_amd64\dbxcli.exe"
if (!(Test-Path -LiteralPath $archiveExePath)) {
throw "Could not find dbxcli.exe after extracting the release archive"
}

Copy-Item -LiteralPath $archiveExePath -Destination $rootExePath -Force
}

function Get-Sha256Checksum($path) {
$sha256 = [System.Security.Cryptography.SHA256]::Create()
$stream = [System.IO.File]::OpenRead($path)

try {
return [System.BitConverter]::ToString($sha256.ComputeHash($stream)).Replace('-', '').ToLowerInvariant()
}
finally {
$stream.Dispose()
$sha256.Dispose()
}
}

if ($env:DBXCLI_CHOCOLATEY_URL64) {
$url64 = $env:DBXCLI_CHOCOLATEY_URL64
}

if ($env:DBXCLI_CHOCOLATEY_CHECKSUM64) {
$checksum64 = $env:DBXCLI_CHOCOLATEY_CHECKSUM64
}

if ($checksum64 -eq "__WINDOWS_AMD64_SHA256__") {
throw "dbxcli Chocolatey package checksum was not set for version $packageVersion"
}

$isRemoteUrl = $url64 -match '^https?://'

if (!$isRemoteUrl) {
if (!(Test-Path -LiteralPath $url64)) {
throw "Local dbxcli archive not found: $url64"
}

$actualChecksum = Get-Sha256Checksum $url64
if ($actualChecksum -ne $checksum64.ToLowerInvariant()) {
throw "Checksum mismatch for $url64. Expected $checksum64, got $actualChecksum"
}

Get-ChocolateyUnzip -FileFullPath $url64 -Destination $toolsDir
Install-DbxcliExe
return
}

$packageArgs = @{
packageName = $packageName
unzipLocation = $toolsDir
url64bit = $url64
checksum64 = $checksum64
checksumType64 = 'sha256'
}

Install-ChocolateyZipPackage @packageArgs
Install-DbxcliExe
16 changes: 16 additions & 0 deletions packaging/homebrew/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Homebrew formula validation

This formula is a draft for submission to `homebrew/core`.
Homebrew should build `dbxcli` from the tagged source tarball, not from release binaries.

Before submitting a new version:

1. Update `url` and `sha256` in `dbxcli.rb` to the new tag source tarball.
2. Run:
```sh
brew audit --new --formula ./packaging/homebrew/dbxcli.rb
brew install --build-from-source ./packaging/homebrew/dbxcli.rb
brew test ./packaging/homebrew/dbxcli.rb
brew uninstall dbxcli
```
3. Copy the formula into a `homebrew/core` pull request after the release is published.
19 changes: 19 additions & 0 deletions packaging/homebrew/dbxcli.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Dbxcli < Formula
desc "Command-line tool for Dropbox users and team admins"
homepage "https://github.com/dropbox/dbxcli"
url "https://github.com/dropbox/dbxcli/archive/refs/tags/v3.3.1.tar.gz"
sha256 "729a50ba14301aff7610089a056d47344157628f182a7c7e31bde4cce935cfe2"
license "Apache-2.0"
head "https://github.com/dropbox/dbxcli.git", branch: "master"

depends_on "go" => :build

def install
system "go", "build", *std_go_args(ldflags: "-s -w -X main.version=#{version}")
generate_completions_from_executable bin/"dbxcli", "completion", shells: [:bash, :zsh, :fish]
end

test do
assert_match "Usage:", shell_output("#{bin}/dbxcli --help")
end
end
Loading