Skip to content

Commit feaa7a7

Browse files
Merge pull request #239 from dropbox/add-github-actions-ci
Add GitHub Actions CI and release workflows
2 parents 89d9b1b + 3d7ae65 commit feaa7a7

6 files changed

Lines changed: 131 additions & 43 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
- uses: actions/setup-go@v6
18+
with:
19+
go-version: "1.25"
20+
- run: go vet ./...
21+
22+
test:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v6
26+
- uses: actions/setup-go@v6
27+
with:
28+
go-version: "1.25"
29+
- run: go test ./...
30+
31+
build:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v6
35+
- uses: actions/setup-go@v6
36+
with:
37+
go-version: "1.25"
38+
- run: ./build.sh

.github/workflows/pages.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- README.md
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- name: Prepare site content
18+
run: |
19+
mkdir -p site
20+
cp README.md site/index.md
21+
cat > site/_config.yml << 'EOF'
22+
title: dbxcli
23+
description: A command line client for Dropbox built using the Go SDK
24+
show_downloads: false
25+
theme: jekyll-theme-hacker
26+
plugins:
27+
- jekyll-mentions
28+
EOF
29+
30+
- uses: JamesIves/github-pages-deploy-action@v4
31+
with:
32+
branch: gh-pages
33+
folder: site
34+
clean-exclude: images

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v6
15+
- uses: actions/setup-go@v6
16+
with:
17+
go-version: "1.25"
18+
- run: go vet ./...
19+
- run: go test ./...
20+
- run: ./build.sh
21+
env:
22+
TRAVIS_TAG: ${{ github.ref_name }}
23+
- uses: softprops/action-gh-release@v3
24+
with:
25+
files: dist/*

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `dbxcli`: A command line tool for Dropbox users and team admins [UNOFFICIAL]
22

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

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

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

52-
1. Make sure `git`, `go`, and `gox` are installed.
53-
2. Create a Go folder. For example, `mkdir $HOME/go` or `mkdir $HOME/.go`. Navigate to it.
54-
3. `go get github.com/dropbox/dbxcli`. That's right, you don't manually clone it, this does it for you.
55-
4. `cd ~/go/src/github.com/dropbox/dbxcli` (adapt accordingly based on step 2).
51+
1. Make sure `git` and `go` are installed.
52+
2. Install the latest released version:
53+
```sh
54+
$ go install github.com/dropbox/dbxcli@latest
55+
```
56+
3. Or build from source:
57+
```sh
58+
$ git clone https://github.com/dropbox/dbxcli.git
59+
$ cd dbxcli
60+
$ go build .
61+
```
62+
63+
To use your own Dropbox app while developing, provide its app key when logging in:
5664

57-
To use your own Dropbox app while developing, provide its app key when running
58-
`dbxcli`:
5965
```sh
60-
$ export DROPBOX_PERSONAL_APP_KEY=your-app-key
66+
$ dbxcli login --app-key=your-app-key
6167
```
6268

63-
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!
64-
6569
## Usage
6670

6771
`dbxcli` is largely self documenting. Run `dbxcli -h` for a list of supported commands:

build.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
#!/bin/bash
22

3-
LDFLAGS="-s -w -X main.version=${TRAVIS_TAG:-TRAVIS_COMMIT}"
4-
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.personalAppKey=${PERSONAL_KEY}"
5-
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.personalAppSecret=${PERSONAL_SECRET}"
6-
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamAccessAppKey=${ACCESS_KEY}"
7-
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamAccessAppSecret=${ACCESS_SECRET}"
8-
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamManageAppKey=${MANAGE_KEY}"
9-
LDFLAGS+=" -X github.com/dropbox/dbxcli/cmd.teamManageAppSecret=${MANAGE_SECRET}"
10-
GO111MODULE=on gox -ldflags="${LDFLAGS}" \
11-
-osarch="darwin/amd64 linux/amd64 windows/amd64 linux/arm openbsd/amd64" \
12-
-output "dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
3+
set -e
4+
5+
VERSION="${TRAVIS_TAG:-${GITHUB_REF_NAME:-dev}}"
6+
LDFLAGS="-s -w -X main.version=${VERSION}"
7+
8+
TARGETS="darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 linux/arm openbsd/amd64 windows/amd64"
9+
10+
mkdir -p dist
11+
12+
for target in $TARGETS; do
13+
GOOS="${target%/*}"
14+
GOARCH="${target#*/}"
15+
output="dist/dbxcli-${GOOS}-${GOARCH}"
16+
if [ "$GOOS" = "windows" ]; then
17+
output="${output}.exe"
18+
fi
19+
echo "Building ${target}..."
20+
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="${LDFLAGS}" -o "$output" .
21+
done

0 commit comments

Comments
 (0)