Skip to content

Commit b31191b

Browse files
Add release packaging and multi-OS CI testing
- CI: multi-OS test matrix (ubuntu, macos, windows), release binary build job, and Chocolatey package install/uninstall validation - Release: package binaries into tar.gz/zip archives with README and LICENSE, generate SHA256SUMS, upload archives to GitHub Releases - Packaging: Chocolatey nuspec and install script with checksum verification, Homebrew formula draft for homebrew-core submission - README: updated installation instructions with archive download, SHA256 verification, and new asset naming scheme
1 parent feaa7a7 commit b31191b

13 files changed

Lines changed: 352 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,63 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
lint:
14-
runs-on: ubuntu-latest
13+
test:
14+
name: Test (${{ matrix.os }})
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-latest, windows-latest]
1520
steps:
1621
- uses: actions/checkout@v6
1722
- uses: actions/setup-go@v6
1823
with:
1924
go-version: "1.25"
2025
- run: go vet ./...
26+
- run: go test ./...
27+
- run: go build ./...
2128

22-
test:
29+
release-build:
30+
name: Release binary build
2331
runs-on: ubuntu-latest
2432
steps:
2533
- uses: actions/checkout@v6
2634
- uses: actions/setup-go@v6
2735
with:
2836
go-version: "1.25"
29-
- run: go test ./...
37+
- run: ./build.sh
38+
env:
39+
VERSION: ci
40+
- run: ./packaging/package-release.sh ci
3041

31-
build:
32-
runs-on: ubuntu-latest
42+
chocolatey:
43+
name: Chocolatey package
44+
runs-on: windows-latest
3345
steps:
3446
- uses: actions/checkout@v6
3547
- uses: actions/setup-go@v6
3648
with:
3749
go-version: "1.25"
38-
- run: ./build.sh
50+
- name: Build Windows binary
51+
shell: pwsh
52+
run: |
53+
New-Item -ItemType Directory -Force dist | Out-Null
54+
go build -ldflags "-s -w -X main.version=0.0.1" -o dist/dbxcli-windows-amd64.exe .
55+
- name: Package Windows archive
56+
shell: bash
57+
env:
58+
TARGETS: windows/amd64
59+
run: ./packaging/package-release.sh 0.0.1
60+
- name: Pack and install Chocolatey package
61+
shell: pwsh
62+
run: |
63+
$ErrorActionPreference = 'Stop'
64+
$PSNativeCommandUseErrorActionPreference = $true
65+
$zip = Resolve-Path .\dist\dbxcli_0.0.1_windows_amd64.zip
66+
$checksum = (Get-FileHash $zip -Algorithm SHA256).Hash.ToLowerInvariant()
67+
choco pack .\packaging\chocolatey\dbxcli\dbxcli.nuspec --version 0.0.1 --outputdirectory .\dist
68+
$env:DBXCLI_CHOCOLATEY_URL64 = $zip.Path
69+
$env:DBXCLI_CHOCOLATEY_CHECKSUM64 = $checksum
70+
choco install dbxcli --source (Resolve-Path .\dist).Path --version 0.0.1 -y --no-progress
71+
dbxcli version
72+
choco uninstall dbxcli -y --no-progress

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ jobs:
1717
go-version: "1.25"
1818
- run: go vet ./...
1919
- run: go test ./...
20+
- run: go build ./...
2021
- run: ./build.sh
2122
env:
22-
TRAVIS_TAG: ${{ github.ref_name }}
23+
VERSION: ${{ github.ref_name }}
24+
- run: ./packaging/package-release.sh
25+
env:
26+
VERSION: ${{ github.ref_name }}
2327
- uses: softprops/action-gh-release@v3
2428
with:
25-
files: dist/*
29+
files: |
30+
dist/*.tar.gz
31+
dist/*.zip
32+
dist/SHA256SUMS

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.idea
2+
/dbxcli
3+
/dist/

README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,20 @@
2121

2222
## Installation
2323

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

26-
### Mac OSX Installation of pre-compiled binaries
26+
Release assets use these names, where `X.Y.Z` is the release version without the leading `v`:
27+
28+
* `dbxcli_X.Y.Z_darwin_amd64.tar.gz`
29+
* `dbxcli_X.Y.Z_darwin_arm64.tar.gz`
30+
* `dbxcli_X.Y.Z_linux_amd64.tar.gz`
31+
* `dbxcli_X.Y.Z_linux_arm64.tar.gz`
32+
* `dbxcli_X.Y.Z_linux_arm.tar.gz`
33+
* `dbxcli_X.Y.Z_openbsd_amd64.tar.gz`
34+
* `dbxcli_X.Y.Z_windows_amd64.zip`
35+
* `SHA256SUMS`
36+
37+
### macOS installation from release archives
2738
These instructions aim to help both experts and novice `dbxcli` users. Please submit an issue if they don't work for you.
2839

2940
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*
@@ -36,10 +47,13 @@ $ cd ~/bin
3647
```sh
3748
export PATH=$PATH:$HOME/bin
3849
```
39-
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.
50+
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`.
4051
```sh
41-
$ wget https://github.com/dropbox/dbxcli/releases/download/v3.2.1/dbxcli-darwin-amd64
42-
$ mv dbxcli-darwin-amd64 dbxcli
52+
$ curl -LO https://github.com/dropbox/dbxcli/releases/download/vX.Y.Z/dbxcli_X.Y.Z_darwin_amd64.tar.gz
53+
$ curl -LO https://github.com/dropbox/dbxcli/releases/download/vX.Y.Z/SHA256SUMS
54+
$ grep 'dbxcli_X.Y.Z_darwin_amd64.tar.gz' SHA256SUMS | shasum -a 256 -c -
55+
$ tar -xzf dbxcli_X.Y.Z_darwin_amd64.tar.gz
56+
$ mv dbxcli_X.Y.Z_darwin_amd64/dbxcli dbxcli
4357
```
4458
5. Finally, make the binary an executable file and you are good to go!
4559
```

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set -e
44

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

89
TARGETS="darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 linux/arm openbsd/amd64 windows/amd64"

packaging/chocolatey/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Chocolatey package validation
2+
3+
The public Chocolatey package uses the Windows release archive and its SHA256 checksum.
4+
5+
Before submitting a new version:
6+
7+
1. Publish a GitHub Release with `dbxcli_<version>_windows_amd64.zip` and `SHA256SUMS`.
8+
2. Copy the Windows archive checksum into `tools/chocolateyInstall.ps1`.
9+
3. Pack and test locally on Windows:
10+
```powershell
11+
choco pack packaging\chocolatey\dbxcli\dbxcli.nuspec --version <version> --outputdirectory dist
12+
choco install dbxcli --source dist --version <version> -y
13+
dbxcli version
14+
choco uninstall dbxcli -y
15+
```
16+
4. Push the resulting `.nupkg` to the Chocolatey community repository.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
3+
<metadata>
4+
<id>dbxcli</id>
5+
<version>0.0.0</version>
6+
<packageSourceUrl>https://github.com/dropbox/dbxcli</packageSourceUrl>
7+
<owners>Dropbox</owners>
8+
<title>dbxcli</title>
9+
<authors>Dropbox</authors>
10+
<projectUrl>https://github.com/dropbox/dbxcli</projectUrl>
11+
<projectSourceUrl>https://github.com/dropbox/dbxcli</projectSourceUrl>
12+
<docsUrl>https://github.com/dropbox/dbxcli#readme</docsUrl>
13+
<bugTrackerUrl>https://github.com/dropbox/dbxcli/issues</bugTrackerUrl>
14+
<licenseUrl>https://github.com/dropbox/dbxcli/blob/master/LICENSE</licenseUrl>
15+
<releaseNotes>https://github.com/dropbox/dbxcli/releases</releaseNotes>
16+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
17+
<summary>Command-line tool for Dropbox users and team admins.</summary>
18+
<description>
19+
dbxcli is an unofficial command-line client for Dropbox users and team admins.
20+
It supports common file operations, account information, sharing commands, and
21+
team administration workflows.
22+
</description>
23+
<tags>dropbox dbxcli cli files sync team-admin</tags>
24+
</metadata>
25+
<files>
26+
<file src="tools\**" target="tools" />
27+
<file src="legal\**" target="legal" />
28+
</files>
29+
</package>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2016 Dropbox
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
VERIFICATION
2+
3+
This package downloads the official dbxcli Windows release archive from:
4+
5+
https://github.com/dropbox/dbxcli/releases
6+
7+
For each package version:
8+
9+
1. Download dbxcli_<version>_windows_amd64.zip.
10+
2. Download SHA256SUMS from the same GitHub Release.
11+
3. Verify that the archive checksum matches the SHA256SUMS entry.
12+
4. Use that checksum as checksum64 in tools/chocolateyInstall.ps1.
13+
14+
The package source is available at:
15+
16+
https://github.com/dropbox/dbxcli
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
4+
$packageName = $env:ChocolateyPackageName
5+
$packageVersion = $env:ChocolateyPackageVersion
6+
7+
$url64 = "https://github.com/dropbox/dbxcli/releases/download/v$packageVersion/dbxcli_${packageVersion}_windows_amd64.zip"
8+
$checksum64 = "__WINDOWS_AMD64_SHA256__"
9+
10+
function Install-DbxcliExe {
11+
$rootExePath = Join-Path $toolsDir 'dbxcli.exe'
12+
if (Test-Path -LiteralPath $rootExePath) {
13+
return
14+
}
15+
16+
$archiveExePath = Join-Path $toolsDir "dbxcli_${packageVersion}_windows_amd64\dbxcli.exe"
17+
if (!(Test-Path -LiteralPath $archiveExePath)) {
18+
throw "Could not find dbxcli.exe after extracting the release archive"
19+
}
20+
21+
Copy-Item -LiteralPath $archiveExePath -Destination $rootExePath -Force
22+
}
23+
24+
function Get-Sha256Checksum($path) {
25+
$sha256 = [System.Security.Cryptography.SHA256]::Create()
26+
$stream = [System.IO.File]::OpenRead($path)
27+
28+
try {
29+
return [System.BitConverter]::ToString($sha256.ComputeHash($stream)).Replace('-', '').ToLowerInvariant()
30+
}
31+
finally {
32+
$stream.Dispose()
33+
$sha256.Dispose()
34+
}
35+
}
36+
37+
if ($env:DBXCLI_CHOCOLATEY_URL64) {
38+
$url64 = $env:DBXCLI_CHOCOLATEY_URL64
39+
}
40+
41+
if ($env:DBXCLI_CHOCOLATEY_CHECKSUM64) {
42+
$checksum64 = $env:DBXCLI_CHOCOLATEY_CHECKSUM64
43+
}
44+
45+
if ($checksum64 -eq "__WINDOWS_AMD64_SHA256__") {
46+
throw "dbxcli Chocolatey package checksum was not set for version $packageVersion"
47+
}
48+
49+
$isRemoteUrl = $url64 -match '^https?://'
50+
51+
if (!$isRemoteUrl) {
52+
if (!(Test-Path -LiteralPath $url64)) {
53+
throw "Local dbxcli archive not found: $url64"
54+
}
55+
56+
$actualChecksum = Get-Sha256Checksum $url64
57+
if ($actualChecksum -ne $checksum64.ToLowerInvariant()) {
58+
throw "Checksum mismatch for $url64. Expected $checksum64, got $actualChecksum"
59+
}
60+
61+
Get-ChocolateyUnzip -FileFullPath $url64 -Destination $toolsDir
62+
Install-DbxcliExe
63+
return
64+
}
65+
66+
$packageArgs = @{
67+
packageName = $packageName
68+
unzipLocation = $toolsDir
69+
url64bit = $url64
70+
checksum64 = $checksum64
71+
checksumType64 = 'sha256'
72+
}
73+
74+
Install-ChocolateyZipPackage @packageArgs
75+
Install-DbxcliExe

0 commit comments

Comments
 (0)