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
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- run: go vet ./...

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- run: go test ./...

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- run: ./build.sh
34 changes: 34 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy Pages

on:
push:
branches: [master]
paths:
- README.md

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6

- name: Prepare site content
run: |
mkdir -p site
cp README.md site/index.md
cat > site/_config.yml << 'EOF'
title: dbxcli
description: A command line client for Dropbox built using the Go SDK
show_downloads: false
theme: jekyll-theme-hacker
plugins:
- jekyll-mentions
EOF

- uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: site
clean-exclude: images
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- run: go vet ./...
- run: go test ./...
- run: ./build.sh
env:
TRAVIS_TAG: ${{ github.ref_name }}
- uses: softprops/action-gh-release@v3
with:
files: dist/*
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `dbxcli`: A command line tool for Dropbox users and team admins [UNOFFICIAL]

[![Build Status](https://travis-ci.org/dropbox/dbxcli.svg?branch=master)](https://travis-ci.org/dropbox/dbxcli)
[![CI](https://github.com/dropbox/dbxcli/actions/workflows/ci.yml/badge.svg)](https://github.com/dropbox/dbxcli/actions/workflows/ci.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/dropbox/dbxcli)](https://goreportcard.com/report/github.com/dropbox/dbxcli)

:warning: WARNING: This project is **NOT official**. What does this mean?
Expand Down Expand Up @@ -47,21 +47,25 @@ $ chmod +x dbxcli
```

### Instructions for building yourself
For newcomers the go build process can be a bit arcane, these steps can be followed to build `dbxcli` yourself.

1. Make sure `git`, `go`, and `gox` are installed.
2. Create a Go folder. For example, `mkdir $HOME/go` or `mkdir $HOME/.go`. Navigate to it.
3. `go get github.com/dropbox/dbxcli`. That's right, you don't manually clone it, this does it for you.
4. `cd ~/go/src/github.com/dropbox/dbxcli` (adapt accordingly based on step 2).
1. Make sure `git` and `go` are installed.
2. Install the latest released version:
```sh
$ go install github.com/dropbox/dbxcli@latest
```
3. Or build from source:
```sh
$ git clone https://github.com/dropbox/dbxcli.git
$ cd dbxcli
$ go build .
```

To use your own Dropbox app while developing, provide its app key when logging in:

To use your own Dropbox app while developing, provide its app key when running
`dbxcli`:
```sh
$ export DROPBOX_PERSONAL_APP_KEY=your-app-key
$ dbxcli login --app-key=your-app-key
```

Finally we're ready to build. Run `go build`, and you'll see a `dbxcli` binary has been created in the current directory. Congrats, we're done!

## Usage

`dbxcli` is largely self documenting. Run `dbxcli -h` for a list of supported commands:
Expand Down
29 changes: 19 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#!/bin/bash

LDFLAGS="-s -w -X main.version=${TRAVIS_TAG:-TRAVIS_COMMIT}"
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.personalAppKey=${PERSONAL_KEY}"
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.personalAppSecret=${PERSONAL_SECRET}"
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamAccessAppKey=${ACCESS_KEY}"
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamAccessAppSecret=${ACCESS_SECRET}"
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamManageAppKey=${MANAGE_KEY}"
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamManageAppSecret=${MANAGE_SECRET}"
GO111MODULE=on gox -ldflags="${LDFLAGS}" \
-osarch="darwin/amd64 linux/amd64 windows/amd64 linux/arm openbsd/amd64" \
-output "dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
set -e

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

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

mkdir -p dist

for target in $TARGETS; do
GOOS="${target%/*}"
GOARCH="${target#*/}"
output="dist/dbxcli-${GOOS}-${GOARCH}"
if [ "$GOOS" = "windows" ]; then
output="${output}.exe"
fi
echo "Building ${target}..."
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="${LDFLAGS}" -o "$output" .
done